Yes ... yet another question about Session State!! - Long

Discussion in 'ASP .Net' started by Martin, Jul 23, 2003.

  1. Martin

    Martin Guest

    Hi all

    As my posting title suggests I'm having problems using InProc Session
    state in my ASP .NET app.

    I wrote a site for a friend which uses ADO .NET to keep track of a
    simple customer/purchases database. A user creates an account and a
    database entry is added to a customer table. Once a user successfully
    logs in with a valid Username/Password I store away the UserID (which
    is the primary key of the Customers table) in the Session object, and
    use this across the app to reference data for display.

    Everything worked perfectly on my server at home : XP Pro, IIS 5.1
    however as soon as i uploaded everything to my host (oneandone.co.uk)
    I began to see intermittent Session state fall out. I was testing for
    Session["UserID"] = null and moving user to a default login page (set
    in web.config) if this was true, the idea being to stop people
    navigating directly to a page without first logging in. This began to
    happen 'randomly' whilst a user was validly logged in. This has
    nothing to do with the timing out of Session. This is set to 100 mins
    in my config file and session sometimes falls out on the first page
    move after valid login.

    The only consistent clue that I can report is that the Nulling of my
    Session object always seems to happen when a refresh of a page is NOT
    instant but when there is some server delay. You know ... you hit F5
    and the server is slow to respond. When this happens I always know
    that Session will be null when page comes back. Maybe this is the key.
    But I don't know the reason.

    Because the site was effectively broken with this behaviour, and the
    system was 'live' I quickly had to tear everything down and recode the
    solution using Query Strings in the urls. Very combersome, but the
    site now works.

    Now the dust has settled I want to find out why the Session state was
    'broken'.
    I believe oneandone use Windows Server 2003 with IIS 6.0. They have
    only very recently started to offer ASP .NET and I suspect they may
    have set something up incorrectly (of course it could be something
    i've done wrong LOL)

    I found the following Knowledge Base articles that point to possible
    answers :
    http://support.microsoft.com/default.aspx?scid=kb;EN-US;316148
    http://support.microsoft.com/default.aspx?scid=kb;en-us;324772

    The first of these provides some sample code to test for Session State
    fallout and I have uploaded this to my host and indeed I get the same
    intermittent 'fallout' as I did with my own code.

    The second of these suggests that the problem could be caused by,
    "Virus scanning software touched some .config files" and goes on to
    say, "This is why the session state is lost when Aspnet_wp.exe (or
    W3wp.exe, for applications that run on Microsoft Internet Information
    Services [IIS] 6.0) or the AppDomain restarts."

    I cannot believe Anti-Virus software on my host can be causing the
    problem, as if this was the case they (and this newsgroup, I'm sure)
    would have been inundated with queries, however, I need to eliminate
    this cause from the equation. I shall mail their support team and ask
    them specifically about the Anti-Virus issue, but I was wondering if
    there was something I could do in code (C# preferably) that could test
    explicitly for W3wp.exe restarting.

    Thinking about it, maybe the server sluggishness just before session
    goes null, that I reported earlier, was this .exe restarting!! ??

    Apologies for the length of the post and thank you to those of you who
    have stuck with it :) I look forward to your suggestions for a way
    forward, or any comments on similar experiences.

    Thank you for listening.

    Kind Regards,

    Martin
     
    Martin, Jul 23, 2003
    #1
    1. Advertising

  2. Martin

    PJ Guest

    The asp.net process may recycle itself and cause you to lose session if the
    process takes a certain % of system memory as defined in the
    machine.confiig. There are plenty of articles on how to monitor this.

    I'm not sure about w2k3, but I'm sure the asp appliation start event will
    run everytime the w3wp.exe restarts, so you could simply log the time to the
    file everytime this happens.

    "Martin" <> wrote in message
    news:...
    > Hi all
    >
    > As my posting title suggests I'm having problems using InProc Session
    > state in my ASP .NET app.
    >
    > I wrote a site for a friend which uses ADO .NET to keep track of a
    > simple customer/purchases database. A user creates an account and a
    > database entry is added to a customer table. Once a user successfully
    > logs in with a valid Username/Password I store away the UserID (which
    > is the primary key of the Customers table) in the Session object, and
    > use this across the app to reference data for display.
    >
    > Everything worked perfectly on my server at home : XP Pro, IIS 5.1
    > however as soon as i uploaded everything to my host (oneandone.co.uk)
    > I began to see intermittent Session state fall out. I was testing for
    > Session["UserID"] = null and moving user to a default login page (set
    > in web.config) if this was true, the idea being to stop people
    > navigating directly to a page without first logging in. This began to
    > happen 'randomly' whilst a user was validly logged in. This has
    > nothing to do with the timing out of Session. This is set to 100 mins
    > in my config file and session sometimes falls out on the first page
    > move after valid login.
    >
    > The only consistent clue that I can report is that the Nulling of my
    > Session object always seems to happen when a refresh of a page is NOT
    > instant but when there is some server delay. You know ... you hit F5
    > and the server is slow to respond. When this happens I always know
    > that Session will be null when page comes back. Maybe this is the key.
    > But I don't know the reason.
    >
    > Because the site was effectively broken with this behaviour, and the
    > system was 'live' I quickly had to tear everything down and recode the
    > solution using Query Strings in the urls. Very combersome, but the
    > site now works.
    >
    > Now the dust has settled I want to find out why the Session state was
    > 'broken'.
    > I believe oneandone use Windows Server 2003 with IIS 6.0. They have
    > only very recently started to offer ASP .NET and I suspect they may
    > have set something up incorrectly (of course it could be something
    > i've done wrong LOL)
    >
    > I found the following Knowledge Base articles that point to possible
    > answers :
    > http://support.microsoft.com/default.aspx?scid=kb;EN-US;316148
    > http://support.microsoft.com/default.aspx?scid=kb;en-us;324772
    >
    > The first of these provides some sample code to test for Session State
    > fallout and I have uploaded this to my host and indeed I get the same
    > intermittent 'fallout' as I did with my own code.
    >
    > The second of these suggests that the problem could be caused by,
    > "Virus scanning software touched some .config files" and goes on to
    > say, "This is why the session state is lost when Aspnet_wp.exe (or
    > W3wp.exe, for applications that run on Microsoft Internet Information
    > Services [IIS] 6.0) or the AppDomain restarts."
    >
    > I cannot believe Anti-Virus software on my host can be causing the
    > problem, as if this was the case they (and this newsgroup, I'm sure)
    > would have been inundated with queries, however, I need to eliminate
    > this cause from the equation. I shall mail their support team and ask
    > them specifically about the Anti-Virus issue, but I was wondering if
    > there was something I could do in code (C# preferably) that could test
    > explicitly for W3wp.exe restarting.
    >
    > Thinking about it, maybe the server sluggishness just before session
    > goes null, that I reported earlier, was this .exe restarting!! ??
    >
    > Apologies for the length of the post and thank you to those of you who
    > have stuck with it :) I look forward to your suggestions for a way
    > forward, or any comments on similar experiences.
    >
    > Thank you for listening.
    >
    > Kind Regards,
    >
    > Martin
     
    PJ, Jul 23, 2003
    #2
    1. Advertising

  3. Hi Martin,

    Didn't you say at the beginning of your message that this host has "only
    very recently" started to support ASP.Net? If so, why would anyone be
    "inundated with queries" about their use of virus protection software? You
    found a Knowledge Base article. That means that this problem has occurred
    and been reported enough times to Microsoft to write a KB article about it.
    Virus protection software has been responsible for many a problem. It's a
    simple matter of a phone call or email to confirm it.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    http://www.takempis.com
    Big things are made up of
    lots of little things.

    "Martin" <> wrote in message
    news:...
    > Hi all
    >
    > As my posting title suggests I'm having problems using InProc Session
    > state in my ASP .NET app.
    >
    > I wrote a site for a friend which uses ADO .NET to keep track of a
    > simple customer/purchases database. A user creates an account and a
    > database entry is added to a customer table. Once a user successfully
    > logs in with a valid Username/Password I store away the UserID (which
    > is the primary key of the Customers table) in the Session object, and
    > use this across the app to reference data for display.
    >
    > Everything worked perfectly on my server at home : XP Pro, IIS 5.1
    > however as soon as i uploaded everything to my host (oneandone.co.uk)
    > I began to see intermittent Session state fall out. I was testing for
    > Session["UserID"] = null and moving user to a default login page (set
    > in web.config) if this was true, the idea being to stop people
    > navigating directly to a page without first logging in. This began to
    > happen 'randomly' whilst a user was validly logged in. This has
    > nothing to do with the timing out of Session. This is set to 100 mins
    > in my config file and session sometimes falls out on the first page
    > move after valid login.
    >
    > The only consistent clue that I can report is that the Nulling of my
    > Session object always seems to happen when a refresh of a page is NOT
    > instant but when there is some server delay. You know ... you hit F5
    > and the server is slow to respond. When this happens I always know
    > that Session will be null when page comes back. Maybe this is the key.
    > But I don't know the reason.
    >
    > Because the site was effectively broken with this behaviour, and the
    > system was 'live' I quickly had to tear everything down and recode the
    > solution using Query Strings in the urls. Very combersome, but the
    > site now works.
    >
    > Now the dust has settled I want to find out why the Session state was
    > 'broken'.
    > I believe oneandone use Windows Server 2003 with IIS 6.0. They have
    > only very recently started to offer ASP .NET and I suspect they may
    > have set something up incorrectly (of course it could be something
    > i've done wrong LOL)
    >
    > I found the following Knowledge Base articles that point to possible
    > answers :
    > http://support.microsoft.com/default.aspx?scid=kb;EN-US;316148
    > http://support.microsoft.com/default.aspx?scid=kb;en-us;324772
    >
    > The first of these provides some sample code to test for Session State
    > fallout and I have uploaded this to my host and indeed I get the same
    > intermittent 'fallout' as I did with my own code.
    >
    > The second of these suggests that the problem could be caused by,
    > "Virus scanning software touched some .config files" and goes on to
    > say, "This is why the session state is lost when Aspnet_wp.exe (or
    > W3wp.exe, for applications that run on Microsoft Internet Information
    > Services [IIS] 6.0) or the AppDomain restarts."
    >
    > I cannot believe Anti-Virus software on my host can be causing the
    > problem, as if this was the case they (and this newsgroup, I'm sure)
    > would have been inundated with queries, however, I need to eliminate
    > this cause from the equation. I shall mail their support team and ask
    > them specifically about the Anti-Virus issue, but I was wondering if
    > there was something I could do in code (C# preferably) that could test
    > explicitly for W3wp.exe restarting.
    >
    > Thinking about it, maybe the server sluggishness just before session
    > goes null, that I reported earlier, was this .exe restarting!! ??
    >
    > Apologies for the length of the post and thank you to those of you who
    > have stuck with it :) I look forward to your suggestions for a way
    > forward, or any comments on similar experiences.
    >
    > Thank you for listening.
    >
    > Kind Regards,
    >
    > Martin
     
    Kevin Spencer, Jul 23, 2003
    #3
  4. Martin

    Martin Guest

    Kevin

    Point taken. I will definately give the help line a ring. That is the
    next time I feel like waiting in a queue for half an hour ;)

    Martin

    "Kevin Spencer" <> wrote in message news:<>...
    > Hi Martin,
    >
    > Didn't you say at the beginning of your message that this host has "only
    > very recently" started to support ASP.Net? If so, why would anyone be
    > "inundated with queries" about their use of virus protection software? You
    > found a Knowledge Base article. That means that this problem has occurred
    > and been reported enough times to Microsoft to write a KB article about it.
    > Virus protection software has been responsible for many a problem. It's a
    > simple matter of a phone call or email to confirm it.
    >
     
    Martin, Jul 24, 2003
    #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. teo
    Replies:
    3
    Views:
    539
  2. Tony K

    Stupid yet simple yes/no question.

    Tony K, Apr 25, 2007, in forum: ASP .Net
    Replies:
    7
    Views:
    603
  3. Alf P. Steinbach
    Replies:
    4
    Views:
    378
    Roland Pibinger
    May 17, 2008
  4. Kai-Uwe Bux
    Replies:
    4
    Views:
    373
    Kai-Uwe Bux
    May 15, 2008
  5. Jamie Herre
    Replies:
    1
    Views:
    201
    why the lucky stiff
    Jan 7, 2005
Loading...

Share This Page