Global.asax and Session State

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • stewartfip@yahoo.com

    Global.asax and Session State

    My global.asax file looks something like this:

    sub Session_Start()
    [some database activity]

    session("sessio nID") = [value from cmd output param]
    end sub

    sub Application_Pre RequestHandlerE xecute()
    if session("sessio nID") <> 0 then
    [do some stuff]
    end if
    end sub

    ....which seems to have worked fine up until this weekend. I have a
    simple routine that e-mails application errors to me and I've been
    HAMMERED suddenly with 'Session state is not available in this context'
    on the line that reads 'if session("sessio nID") <> 0 then...' which
    doesn't make sense because Application_Pre RequestHandlerE xecute was
    supposed to be a safe place to mess around with session variables.

    So I'm at a loss in terms of where to begin troubleshooting this
    problem. Am I referencing session variables in too simple a manner?
    At this point, I'm not clear if this is happening to a given user on
    every page, or if it just happens on their first page view and then
    things are fine thereafter. I get an error every, oh, three minutes.
    So it's happening a lot.

    I'll provide more details, just tell me what you need to know. I'm
    reasonably new to ASP.Net and am using VB, if that wasn't completely
    obvious.

  • Jhonda

    #2
    RE: Global.asax and Session State

    I experienced the same issue after updating the IIS properies for my site
    from ASP 1.1 to ASP 2.0. I switched it back to 1.1 until I recode around the
    issue, and the problem did go away.

    I would also like to know why Session is no longer valid at this point in
    Global.asax.

    "stewartfip@yah oo.com" wrote:
    [color=blue]
    > My global.asax file looks something like this:
    >
    > sub Session_Start()
    > [some database activity]
    >
    > session("sessio nID") = [value from cmd output param]
    > end sub
    >
    > sub Application_Pre RequestHandlerE xecute()
    > if session("sessio nID") <> 0 then
    > [do some stuff]
    > end if
    > end sub
    >
    > ....which seems to have worked fine up until this weekend. I have a
    > simple routine that e-mails application errors to me and I've been
    > HAMMERED suddenly with 'Session state is not available in this context'
    > on the line that reads 'if session("sessio nID") <> 0 then...' which
    > doesn't make sense because Application_Pre RequestHandlerE xecute was
    > supposed to be a safe place to mess around with session variables.
    >
    > So I'm at a loss in terms of where to begin troubleshooting this
    > problem. Am I referencing session variables in too simple a manner?
    > At this point, I'm not clear if this is happening to a given user on
    > every page, or if it just happens on their first page view and then
    > things are fine thereafter. I get an error every, oh, three minutes.
    > So it's happening a lot.
    >
    > I'll provide more details, just tell me what you need to know. I'm
    > reasonably new to ASP.Net and am using VB, if that wasn't completely
    > obvious.
    >
    >[/color]

    Comment

    • Edwin Knoppert

      #3
      Re: Global.asax and Session State

      Afaik everything in Application_ is not related to session.
      Unf. i needed as well :)



      "Jhonda" <Jhonda@discuss ions.microsoft. com> schreef in bericht
      news:47BBD9ED-2977-400F-9B2E-D39EC632FDF4@mi crosoft.com...[color=blue]
      >I experienced the same issue after updating the IIS properies for my site
      > from ASP 1.1 to ASP 2.0. I switched it back to 1.1 until I recode around
      > the
      > issue, and the problem did go away.
      >
      > I would also like to know why Session is no longer valid at this point in
      > Global.asax.
      >
      > "stewartfip@yah oo.com" wrote:
      >[color=green]
      >> My global.asax file looks something like this:
      >>
      >> sub Session_Start()
      >> [some database activity]
      >>
      >> session("sessio nID") = [value from cmd output param]
      >> end sub
      >>
      >> sub Application_Pre RequestHandlerE xecute()
      >> if session("sessio nID") <> 0 then
      >> [do some stuff]
      >> end if
      >> end sub
      >>
      >> ....which seems to have worked fine up until this weekend. I have a
      >> simple routine that e-mails application errors to me and I've been
      >> HAMMERED suddenly with 'Session state is not available in this context'
      >> on the line that reads 'if session("sessio nID") <> 0 then...' which
      >> doesn't make sense because Application_Pre RequestHandlerE xecute was
      >> supposed to be a safe place to mess around with session variables.
      >>
      >> So I'm at a loss in terms of where to begin troubleshooting this
      >> problem. Am I referencing session variables in too simple a manner?
      >> At this point, I'm not clear if this is happening to a given user on
      >> every page, or if it just happens on their first page view and then
      >> things are fine thereafter. I get an error every, oh, three minutes.
      >> So it's happening a lot.
      >>
      >> I'll provide more details, just tell me what you need to know. I'm
      >> reasonably new to ASP.Net and am using VB, if that wasn't completely
      >> obvious.
      >>
      >>[/color][/color]


      Comment

      Working...