Session state not working

L

lumazi

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 enableSessionState 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"
sqlConnectionString="data source=localhost;Integrated
Security=SSPI;Initial Catalog=ASPState"
cookiesless="false"
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
 
J

Juan T. Llibre

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=localhost;" 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.
 
L

lumazi

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
 
J

Juan T. Llibre

Hi, Scott.

A few more things to check :

1. Is this a typo ? : cookiesless="false"
That should be : cookieless="false"

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

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

<configuration>
<system.web>
<sessionState mode="SQLServer"
sqlConnectionString="Integrated Security=SSPI;data source=SampleSqlServer;" />
</system.web>
</configuration>

If you specify a trusted connection to your SQL Server in the configuration file using the
sessionState element's sqlConnectionString attribute, the SessionStateModule 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.exe Tool ?

Follow the instructions at :
http://windowssdk.msdn.microsoft.co...html/0bb0a3a3-650f-4c47-a0c5-b08b9b591bb4.asp

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

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

lumazi

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
 

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,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top