Session variable being cleared--why?

Discussion in 'ASP .Net' started by Chad, Jun 6, 2007.

  1. Chad

    Chad Guest

    When I visit a specific web page, Request.aspx, for some reason my session
    variables are cleared.

    I noticed that there is a "EnableSessionState" property on the document
    object that has three allowed states "True", "false" and "Readonly". I
    would assume that by default, if not specified, it is "true".

    however, I decided to explicitly set it to true to see if it helps.

    i set it to true in the WebForm. no luck.. Then i realized that it used a
    Master Page, so I tried to set the same property there to true.

    I get the following error message:

    Error 3 Error parsing attribute 'enablesessionstate': Type
    'System.Web.UI.MasterPage' does not have a public property named
    'enablesessionstate'.
    C:\MyDocs\vss\SMIT\SMIT.PackTrack\PackTrack.NET\BIMasterPage.master 1


    Any idea why I can't set this property or how to prevent the Session
    Variable from being cleared. I access the web page using a relative Url, do
    not explicitly clear the variable, am not using frames, am using only 1 IE
    Window.

    Can anyone suggest a reason why this is happending?

    Also, on a separate thought...Is there any easy way to log response times
    (Page Post times) in a centralized way such as the ASAX file. I assume there
    is something in TRACING, but I dont know much about. A little direction
    point would be helpful.

    Thanks!
     
    Chad, Jun 6, 2007
    #1
    1. Advertising

  2. Chad

    Chad Guest

    I found the issue:

    I did something like this is the top of my aspx code behind class:

    Private UserId As String = Session("UserId")

    I change it to

    Private UserId As String

    and in the form load add:

    UserId = Session("UserId")

    Apparently, variables are initialized before the session object is
    avaialable for use.


    "Chad" <> wrote in message
    news:f46kr0$isr$...
    > When I visit a specific web page, Request.aspx, for some reason my session
    > variables are cleared.
    >
    > I noticed that there is a "EnableSessionState" property on the document
    > object that has three allowed states "True", "false" and "Readonly". I
    > would assume that by default, if not specified, it is "true".
    >
    > however, I decided to explicitly set it to true to see if it helps.
    >
    > i set it to true in the WebForm. no luck.. Then i realized that it used a
    > Master Page, so I tried to set the same property there to true.
    >
    > I get the following error message:
    >
    > Error 3 Error parsing attribute 'enablesessionstate': Type
    > 'System.Web.UI.MasterPage' does not have a public property named
    > 'enablesessionstate'.
    > C:\MyDocs\vss\SMIT\SMIT.PackTrack\PackTrack.NET\BIMasterPage.master 1
    >
    >
    > Any idea why I can't set this property or how to prevent the Session
    > Variable from being cleared. I access the web page using a relative Url,
    > do not explicitly clear the variable, am not using frames, am using only 1
    > IE Window.
    >
    > Can anyone suggest a reason why this is happending?
    >
    > Also, on a separate thought...Is there any easy way to log response times
    > (Page Post times) in a centralized way such as the ASAX file. I assume
    > there is something in TRACING, but I dont know much about. A little
    > direction point would be helpful.
    >
    > Thanks!
    >
    >
    >
     
    Chad, Jun 8, 2007
    #2
    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. =?Utf-8?B?Z2luZ2VyYmJt?=

    HttpHandler not being cleared

    =?Utf-8?B?Z2luZ2VyYmJt?=, Feb 19, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    1,718
    Martin Dechev
    Feb 19, 2004
  2. =?Utf-8?B?Q2hyaXM=?=

    drop down control being cleared

    =?Utf-8?B?Q2hyaXM=?=, Dec 14, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    477
    =?Utf-8?B?Q2hyaXM=?=
    Dec 14, 2004
  3. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,221
    Smokey Grindel
    Dec 2, 2006
  4. JP SIngh

    Session variable cleared by IIS

    JP SIngh, Jul 14, 2004, in forum: ASP General
    Replies:
    2
    Views:
    204
    Aaron [SQL Server MVP]
    Jul 14, 2004
  5. JP SIngh
    Replies:
    1
    Views:
    438
    Evertjan.
    Aug 9, 2004
Loading...

Share This Page