473,666 Members | 2,368 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Session state not working

Hello Everyone,

I have a confusing problem. I'm getting the following error
message on an ASPX page ...

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

I've seen it before and figured something was shut off. I checked
and by default the session state is turned ON. I've got the web.config
setup for session state as follows ...

<sessionState
mode = "SqlServer"
sqlConnectionSt ring="data source=localhos t;Integrated
Security=SSPI;I nitial Catalog=ASPStat e"
cookiesless="fa lse"
timeout="20"/>

I'm at a bit of a loss as to what's happening. According to the
code and setup, session state should be working. Am I missing
something? what else can I check?

Thank you in advance for any assistance,
Scott Vercuski

Apr 12 '06 #1
4 2258
Hi, Scott.

Have you verified that there's localhost access to the SQL Server in question ?

Check to see if your SQL Server is accesible via "localhost" .

SQL Server connection strings to "(local)" are quite common, but not to "localhost" .
Sql Server connections to "localhost" are much less common.

Try using "data source=(local); " instead of "data source=localhos t;" in the connection string
and see if that allows access to your SQL Server.

Also, you could try testing with sessionState set to "InProc", just for test purposes.
If that gets your sessionState working, the problem is -definitely- access to SQL Server.


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
<lu****@gmail.c om> wrote in message news:11******** *************@u 72g2000cwu.goog legroups.com...
Hello Everyone,

I have a confusing problem. I'm getting the following error
message on an ASPX page ...

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

I've seen it before and figured something was shut off. I checked
and by default the session state is turned ON. I've got the web.config
setup for session state as follows ...

<sessionState
mode = "SqlServer"
sqlConnectionSt ring="data source=localhos t;Integrated
Security=SSPI;I nitial Catalog=ASPStat e"
cookiesless="fa lse"
timeout="20"/>

I'm at a bit of a loss as to what's happening. According to the
code and setup, session state should be working. Am I missing
something? what else can I check?

Thank you in advance for any assistance,
Scott Vercuski

Apr 12 '06 #2
Juan,

Thank you for your reply!

I originally had the session state set at inProc and it was still
giving me the same error.

I tried your suggestion and changed the localhost to the SQL
Instance name to no avail. I still get the same message.

Thank you,
Scott Vercuski

Apr 12 '06 #3
Hi, Scott.

A few more things to check :

1. Is this a typo ? : cookiesless="fa lse"
That should be : cookieless="fal se"

2. Could you check to see if you can connect to another database in your
SQL Server using either "localhost" , "(local)", or "Instance_n ame" ?

3. Check your connection string. You are not using case-sensitive strings.

<configuratio n>
<system.web>
<sessionState mode="SQLServer "
sqlConnectionSt ring="Integrate d Security=SSPI;d ata source=SampleSq lServer;" />
</system.web>
</configuration>

If you specify a trusted connection to your SQL Server in the configuration file using the
sessionState element's sqlConnectionSt ring attribute, the SessionStateMod ule will connect
to SQL Server using SQL Server integrated security. The connection will be made using
the ASP.NET process identity or the user credentials supplied for the identity configuration
element, if they exist.

4. Did you run the Aspnet_regsql.e xe Tool ?

Follow the instructions at :
http://windowssdk.msdn.microsoft.com...8b9b591bb4.asp

if you haven't installed the SQL Server database with the Aspnet_regsql.e xe tool.

Let us know what you did, and how it came out, OK ?

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
<lu****@gmail.c om> wrote in message news:11******** ************@t3 1g2000cwb.googl egroups.com...
Juan,

Thank you for your reply!

I originally had the session state set at inProc and it was still
giving me the same error.

I tried your suggestion and changed the localhost to the SQL
Instance name to no avail. I still get the same message.

Thank you,
Scott Vercuski


Apr 12 '06 #4
Juan,

Sorry the cookiesless was a typo on my part. It's correct in the
web.config file.

I've been told by my supervisor to go back to the InProc state
instead of SQL but I'm still getting the same error. What might cause
the error even through everything appears to be configured correctly?

Thanks,
Scott

Apr 12 '06 #5

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

Similar topics

1
1782
by: yoshibebe | last post by:
Hi, I have developed a project on my local machine. The session state variables are working fine on my local machine. When I port it into a another server called v-projects, and I try to run the project from that other server, the session state variables are being set randomly. For example, in the following code: SetSelectionSessionState();...
9
9772
by: charliewest | last post by:
Hello - I have images saved in my SQL SERVER 2000 database. Using ASP.NET (C#) is there any way to temporarily save an image to a session object, and after running some other operations, later retrieve the image from the session object, convert it back to an image, and re-save it to the database? Thanks?
5
548
by: Sean | last post by:
Problem with sessions I have created an application without concern for sessions. As it turns out I think that might be my undoing. What I have: I have an online quiz. I don’t need to know users or save any data. If the application crashes or user exits the program they should simply start again. Pretty basic. All interactions are stored in an array (not much going on to save to a
5
1967
by: Steven Blair | last post by:
I have the following code: Session = new CurrentUser("TEST"); When I postback to the server, the Session is null. My guess is a only the refence to my actual class is stored, rather than the class. Looking on the internet, one solution posted was populating Session in Session_Start in a global.asax file. Again, on postback, the value is
8
5347
by: Andrew Teece | last post by:
Hope someone can help. We are trying to deploy an ASP.Net 2.0 application to a 3-node webfarm. The application uses the ReportViewer control in local mode, hence we need session state. Because we dont wan't a single point of failure we use SQL Session State. I have setup a persistant sql session state database on a SQL 2000 server (this is a cluster in production, so no SPOF) I have setup our web.config files to include; " <sessionState...
2
16822
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 in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the <configuration>\<system.web>\<httpModulessection in the application configuration." In my Web.config I put the...
2
5000
by: StanB | last post by:
I came across this weird problem: 1. Session state stops working after the app is deployed to another server because IE does not accept cookies. 2. It works if cookieless="true" in the web.config 3. Yes, I tried IE - Tools - Privacy - Accept All Cookies and also Override automatic cookie handling, Always allow session cookes
10
4389
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 configuration file or in the page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the <configuration><system.web><httpModulessection in the application configuration. Here is my current...
5
5891
by: =?Utf-8?B?QmlsbHkgWmhhbmc=?= | last post by:
Hi All, I am using asp.net session state service to store session. The concurrent online user will be almost 2000. Could asp.net session state service afford this? Is there any limitation about asp.net session state service? -Billy
0
8440
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8638
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7381
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6191
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4193
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4365
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2769
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2006
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.