Session state can only be used when enableSessionState is set to true, either in a configuration fil

D

David Lozzi

Error:

Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive

at line 6

Line 4: <script RUNAT="SERVER">
Line 5:
Line 6: Dim sqlQry as string = "INSERT INTO logs (UID,Note,Description) VALUES " & Session.Contents("UID") & ", 'LOGOUT',''"

and I have this at the first line:

<%@ Page Language="VB" debug="true" EnableSessionState="ReadOnly" %>

why?

thanks,
 
D

David Lozzi

I believe I corrected that issue, however the session variables are empty. Here is where I am assigning them on the first page:
<script runat="server">
...dim rec as .....

Session("UID") = rec("id")
Session("UserName") = rec("username")
Session("Security") = rec("security")
Session("Fullname") = rec("fname") & " " & rec("lname")
Session("CompanyName") = rec("companyname")
Session("CompanyShort") = rec("companyshort")
Session("CompanyWWW") = rec("companywww")
Session("CompanyLogo") = rec("companylogo")
</script>

if I use the somewhere else like so: Welcome <%=session("Fullname")%>!, it works fine, but when I try to use them in the following, its gone. Is it the EnableSessionState=true?

<%@ Page Language="VB" EnableSessionState="ReadOnly" debug="true" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<script RUNAT="SERVER">

sub page_load(sender as object, e as eventargs)
Dim sqlQry as string = "INSERT INTO logs ([UID] , [Note] , [Description]) VALUES ('" & Session("UID") & "' , 'LOGOUT' , '" & Session("Fullname") & " logged out')"
Dim sqlConn as string = "server=12;database=inventory;user id=sa;password=asd"
Dim myConnection As New SqlConnection(sqlConn)
Dim myCommand As New SqlCommand()
myCommand.CommandText = sqlQry
myCommand.Connection = myConnection
myConnection.Open()
myCommand.ExecuteNonQuery
end sub
</script>

Bye <%=session("FullName")%>.


It is gone in the last <%=%> tag too!!

Thanks!


--
David Lozzi
Web Applications/Network Specialist
Delphi Technology Solutions, Inc.
dlozzi(remove-this)@delphi-ts.com


Error:

Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive

at line 6

Line 4: <script RUNAT="SERVER">
Line 5:
Line 6: Dim sqlQry as string = "INSERT INTO logs (UID,Note,Description) VALUES " & Session.Contents("UID") & ", 'LOGOUT',''"

and I have this at the first line:

<%@ Page Language="VB" debug="true" EnableSessionState="ReadOnly" %>

why?

thanks,
 
D

David Lozzi

Just shoot me now...i figured it out, the EnableSessionState was set to ReadOnly, kinda weird how that happens....

--
David Lozzi
Web Applications/Network Specialist
Delphi Technology Solutions, Inc.
dlozzi(remove-this)@delphi-ts.com


I believe I corrected that issue, however the session variables are empty. Here is where I am assigning them on the first page:
<script runat="server">
...dim rec as .....

Session("UID") = rec("id")
Session("UserName") = rec("username")
Session("Security") = rec("security")
Session("Fullname") = rec("fname") & " " & rec("lname")
Session("CompanyName") = rec("companyname")
Session("CompanyShort") = rec("companyshort")
Session("CompanyWWW") = rec("companywww")
Session("CompanyLogo") = rec("companylogo")
</script>

if I use the somewhere else like so: Welcome <%=session("Fullname")%>!, it works fine, but when I try to use them in the following, its gone. Is it the EnableSessionState=true?

<%@ Page Language="VB" EnableSessionState="ReadOnly" debug="true" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<script RUNAT="SERVER">

sub page_load(sender as object, e as eventargs)
Dim sqlQry as string = "INSERT INTO logs ([UID] , [Note] , [Description]) VALUES ('" & Session("UID") & "' , 'LOGOUT' , '" & Session("Fullname") & " logged out')"
Dim sqlConn as string = "server=12;database=inventory;user id=sa;password=asd"
Dim myConnection As New SqlConnection(sqlConn)
Dim myCommand As New SqlCommand()
myCommand.CommandText = sqlQry
myCommand.Connection = myConnection
myConnection.Open()
myCommand.ExecuteNonQuery
end sub
</script>

Bye <%=session("FullName")%>.


It is gone in the last <%=%> tag too!!

Thanks!


--
David Lozzi
Web Applications/Network Specialist
Delphi Technology Solutions, Inc.
dlozzi(remove-this)@delphi-ts.com


Error:

Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive

at line 6

Line 4: <script RUNAT="SERVER">
Line 5:
Line 6: Dim sqlQry as string = "INSERT INTO logs (UID,Note,Description) VALUES " & Session.Contents("UID") & ", 'LOGOUT',''"

and I have this at the first line:

<%@ Page Language="VB" debug="true" EnableSessionState="ReadOnly" %>

why?

thanks,
 
A

Alvin Bruney [MVP]

Just shoot me now
where? i'm aiming straight for the head

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Just shoot me now...i figured it out, the EnableSessionState was set to ReadOnly, kinda weird how that happens....

--
David Lozzi
Web Applications/Network Specialist
Delphi Technology Solutions, Inc.
dlozzi(remove-this)@delphi-ts.com


I believe I corrected that issue, however the session variables are empty. Here is where I am assigning them on the first page:
<script runat="server">
...dim rec as .....

Session("UID") = rec("id")
Session("UserName") = rec("username")
Session("Security") = rec("security")
Session("Fullname") = rec("fname") & " " & rec("lname")
Session("CompanyName") = rec("companyname")
Session("CompanyShort") = rec("companyshort")
Session("CompanyWWW") = rec("companywww")
Session("CompanyLogo") = rec("companylogo")
</script>

if I use the somewhere else like so: Welcome <%=session("Fullname")%>!, it works fine, but when I try to use them in the following, its gone. Is it the EnableSessionState=true?

<%@ Page Language="VB" EnableSessionState="ReadOnly" debug="true" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<script RUNAT="SERVER">

sub page_load(sender as object, e as eventargs)
Dim sqlQry as string = "INSERT INTO logs ([UID] , [Note] , [Description]) VALUES ('" & Session("UID") & "' , 'LOGOUT' , '" & Session("Fullname") & " logged out')"
Dim sqlConn as string = "server=12;database=inventory;user id=sa;password=asd"
Dim myConnection As New SqlConnection(sqlConn)
Dim myCommand As New SqlCommand()
myCommand.CommandText = sqlQry
myCommand.Connection = myConnection
myConnection.Open()
myCommand.ExecuteNonQuery
end sub
</script>

Bye <%=session("FullName")%>.


It is gone in the last <%=%> tag too!!

Thanks!


--
David Lozzi
Web Applications/Network Specialist
Delphi Technology Solutions, Inc.
dlozzi(remove-this)@delphi-ts.com


Error:

Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive

at line 6

Line 4: <script RUNAT="SERVER">
Line 5:
Line 6: Dim sqlQry as string = "INSERT INTO logs (UID,Note,Description) VALUES " & Session.Contents("UID") & ", 'LOGOUT',''"

and I have this at the first line:

<%@ Page Language="VB" debug="true" EnableSessionState="ReadOnly" %>

why?

thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top