Receiving error about enableSessionState; Its already set to true

Discussion in 'ASP .Net' started by =?Utf-8?B?U2VhbiBXLg==?=, Nov 24, 2004.

  1. 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
     
    =?Utf-8?B?U2VhbiBXLg==?=, Nov 24, 2004
    #1
    1. Advertising

  2. 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

    "Sean W." <Sean > wrote in message
    news:...
    > 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
    >
     
    Jeffrey Palermo [MCP], Nov 24, 2004
    #2
    1. Advertising

  3. Re: Receiving error about enableSessionState; Its already set to

    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
    >
     
    =?Utf-8?B?U2VhbiBXLg==?=, Nov 24, 2004
    #3
  4. Re: Receiving error about enableSessionState; Its already set to

    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

    "Sean W." <> wrote in message
    news:...
    > 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
    > >
     
    Jeffrey Palermo [MCP], Nov 25, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Baughman
    Replies:
    6
    Views:
    13,140
    Natty Gur
    Dec 24, 2003
  2. David Lozzi
    Replies:
    3
    Views:
    12,765
    Alvin Bruney [MVP]
    Aug 10, 2004
  3. Rick
    Replies:
    0
    Views:
    526
  4. Paul
    Replies:
    3
    Views:
    1,146
  5. bdb112
    Replies:
    45
    Views:
    1,399
    jazbees
    Apr 29, 2009
Loading...

Share This Page