Receiving error about enableSessionState; Its already set to true

G

Guest

I keep getting this error.
"Session state can only be used when enableSessionState is set to true,
either in a configuration file or in the Page directive"

This occurs when I try to add a session variable.
....
Session.Add("Nameplate", 1)
....

That is in a button click event.

I've seen many forum entries about this but no suggestions seem to work. I
could use some more leads.

Thanks,

Sean
 
J

Jeffrey Palermo [MCP]

Sean,
If you look at the error message, you can glean that maybe session state
isn't enabled on your page. Do you have EnableSessionState="true" in your
@Page directive? Is EnableSessionState false in your web.config file? If
you can post a page and web.config file, then the problem can be diagnosed.

Another test to use:
Comment out your Session.Add() line and enter Trace.Warn(EnableSessionState)
Then look at your trace content to see if you get true or false. If you are
unfamiliar with Trace, you can use Response.Write(EnableSessionState) to get
the value.

Best regards,
Jeffrey Palermo
 
G

Guest

Jeffrey,
Thanks for a response.

I have already tried to force EnableSessionState=true in the page directive
of the two pages. Also in web.config it looks like

<sessionState
mode="InProc"
cookieless="false"
timeout="20"
EnableSessionState="True"
/>

I tried to put in Response.Write(EnableSessionState) but enablesessionstate
is not a recognized object. Keep in mind this is in the VB file that is a
"Code Behind", should it matter.

Thanks,

Sean
 
J

Jeffrey Palermo [MCP]

Sean,
This problem has happened to some others (try pasting the error message
in a google groups search). Delete the IIS application and recreate a new
virtual directory in IIS. Set it as an application, and then put your VS
project in this new IIS directory. That has fixed the problem for some
others. It's not a code problem.

Best regards,
Jeffrey Palermo
 

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

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top