473,395 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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

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,

--
David Lozzi
Web Applications/Network Specialist
Delphi Technology Solutions, Inc.
dlozzi(remove-this)@delphi-ts.com
Nov 18 '05 #1
3 6983
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
"David Lozzi" <dlozzi(remove-this)@delphi-ts.com> wrote in message news:eS****************@TK2MSFTNGP11.phx.gbl...
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,

--
David Lozzi
Web Applications/Network Specialist
Delphi Technology Solutions, Inc.
dlozzi(remove-this)@delphi-ts.com
Nov 18 '05 #2
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
"David Lozzi" <dlozzi(remove-this)@delphi-ts.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl...
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
"David Lozzi" <dlozzi(remove-this)@delphi-ts.com> wrote in message news:eS****************@TK2MSFTNGP11.phx.gbl...
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,

--
David Lozzi
Web Applications/Network Specialist
Delphi Technology Solutions, Inc.
dlozzi(remove-this)@delphi-ts.com
Nov 18 '05 #3
>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
"David Lozzi" <dlozzi(remove-this)@delphi-ts.com> wrote in message news:OF**************@TK2MSFTNGP11.phx.gbl...
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
"David Lozzi" <dlozzi(remove-this)@delphi-ts.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl...
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
"David Lozzi" <dlozzi(remove-this)@delphi-ts.com> wrote in message news:eS****************@TK2MSFTNGP11.phx.gbl...
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,

--
David Lozzi
Web Applications/Network Specialist
Delphi Technology Solutions, Inc.
dlozzi(remove-this)@delphi-ts.com
Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mike | last post by:
I have an aspx.vb page that is inherits a base.vb class. Within the class I am trying to check if a session cookie exists (ie If session("name") = False Then). However I keep getting the error: ...
1
by: Axel Dahmen | last post by:
Hi, I've added a property to my Page base class (this base class inherits from Page and all my aspx.cs classes inherit from my base class). This property of mine uses the Session object to...
0
by: Robert Kruschke | last post by:
I have a two page ASP.net application. I use session variables. I set the session variable in the first page and read it in the second. The problem is that the second page has a datagrid, the...
6
by: KevinGravelle | last post by:
What is wrong with this picture? I'm trying to set my shopping cart text on my home page using the following function that is executed when the class is constructed: protected string...
2
by: ras26 | last post by:
I have a WebSite "App1" which has an external assembly "Lib1". Inside this external assembly we have developed some classes that derive from "System.Web.UI.Page". One of these pages is called...
3
by: Paul | last post by:
Hi All, In my application, I wished to check certain things on each page load, so rather than paste the same code in each pages constructor, I thought it would be more logical to inherit from...
2
by: fniles | last post by:
I am using Visual Studio 2005. In my ASPX page, when I try to use Session, I got the error "Session state can only be used when enableSessionState is set to true, either in a configuration file or...
10
by: =?Utf-8?B?V2FubmFiZQ==?= | last post by:
I've been on this for a while, and cannot figure it out. Can someone please help with this message? SessionState can only be used when EnableSessionState is set to true, either in a...
4
by: Cirene | last post by:
In my web.config I added <pages enableSessionState="true">. In each of my pages I also added EnableSessionState="True" to the Page declaration. (I didn't think this was necessary, but...) ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.