Session_End Event does not Fire.

Discussion in 'ASP .Net' started by =?Utf-8?B?T2xkUHJvZ3JhbW1lcg==?=, Sep 19, 2005.

  1. All the documentation and discussion I have read indicate that the
    Session_End is not supposed to fire unless you are in "inProc" Session state
    mode, and then only on Session Timeout or at Session Abandon. I need the
    event to fire at Session timeout in order to capture and store the Datetime
    this occurs. However in the application I am writing, I have been unable
    discern any indication that the event is firing. I have used break points,
    writes to a database table, and writes to a text file to indicate when this
    event fires. So far I have got nothing back. Yet I am able to verify the
    the session has timed out. I have no indication of code failure, but nothing
    happens when this event is supposed to fire. I really do need this so
    information would be hugely appreciated.

    ERJ MCSD MCDBA.
    =?Utf-8?B?T2xkUHJvZ3JhbW1lcg==?=, Sep 19, 2005
    #1
    1. Advertising

  2. =?Utf-8?B?T2xkUHJvZ3JhbW1lcg==?=

    Marina Guest

    1) How are you sure that the session has indeed timed out?
    2) Are you sure whatever code you have in Session_End isn't failing due to a
    coding error?
    3) Show us the code you have for your Session_End handler

    "OldProgrammer" <> wrote in message
    news:...
    > All the documentation and discussion I have read indicate that the
    > Session_End is not supposed to fire unless you are in "inProc" Session
    > state
    > mode, and then only on Session Timeout or at Session Abandon. I need the
    > event to fire at Session timeout in order to capture and store the
    > Datetime
    > this occurs. However in the application I am writing, I have been
    > unable
    > discern any indication that the event is firing. I have used break
    > points,
    > writes to a database table, and writes to a text file to indicate when
    > this
    > event fires. So far I have got nothing back. Yet I am able to verify the
    > the session has timed out. I have no indication of code failure, but
    > nothing
    > happens when this event is supposed to fire. I really do need this so
    > information would be hugely appreciated.
    >
    > ERJ MCSD MCDBA.
    >
    Marina, Sep 19, 2005
    #2
    1. Advertising

  3. =?Utf-8?B?T2xkUHJvZ3JhbW1lcg==?=

    Hans Kesting Guest

    OldProgrammer wrote:
    > All the documentation and discussion I have read indicate that the
    > Session_End is not supposed to fire unless you are in "inProc"
    > Session state mode, and then only on Session Timeout or at Session
    > Abandon. I need the event to fire at Session timeout in order to
    > capture and store the Datetime this occurs. However in the
    > application I am writing, I have been unable discern any indication
    > that the event is firing. I have used break points, writes to a
    > database table, and writes to a text file to indicate when this event
    > fires. So far I have got nothing back. Yet I am able to verify the
    > the session has timed out. I have no indication of code failure, but
    > nothing happens when this event is supposed to fire. I really do
    > need this so information would be hugely appreciated.
    >
    > ERJ MCSD MCDBA.


    You didn't specify, but when do you expect the Session_End to
    occur? It's 20 minutes (by default) after the last request for this
    session, not (as a lot of people assume) as soon as the browser
    closes or the user "navigates away".

    Hans Kesting
    Hans Kesting, Sep 19, 2005
    #3
  4. See above my post 9/19/05 1:25 PST

    Here:

    Dim swObject As StreamWriter 'Text Stream Object
    Dim sPath As String

    sPath = Server.MapPath("testClose.txt")

    swObject = File.CreateText(sPath)
    swObject.Write("closing" & CStr(Now()))
    swObject = Nothing


    "S. Justin Gengo" wrote:

    > May we see your OnSessionEnd method?
    >
    > --
    > Sincerely,
    >
    > S. Justin Gengo, MCP
    > Web Developer / Programmer
    >
    > www.aboutfortunate.com
    >
    > "Out of chaos comes order."
    > Nietzsche
    > "OldProgrammer" <> wrote in message
    > news:...
    > > The original question specifies
    > > 1. First tried to run needed code, then
    > > 2. Tried to write to dB table (hardcoding all connection strings and
    > > values), then
    > > 3. writing to a plain vanilla text file.
    > > 4. I tried setting the web.config file to show time out value of 2
    > > minutes.
    > > Then when that did not work reset it back to 20 minutes and waited one
    > > hour.
    > > All the seesion variables are gone and the application behaves as it is
    > > supposed to when the session variables have been lost. The only thing
    > > that
    > > did not happen was the write to the DB table then text file.
    > >
    > > So I know the session did time out.
    > >
    > >
    > > "S. Justin Gengo" wrote:
    > >
    > >> On top of that setting a breakpoint won't work. .NET connects to the web
    > >> app
    > >> and listens to what it's doing in order to hit breakpoints. I believe
    > >> that
    > >> will keep the session open.
    > >>
    > >> I would set a write to a database/text file inside of the session end
    > >> handler, set your session time out to one minute (or less), compile the
    > >> application, connect to it manually outside of .NET
    > >> (http://localhost/yourappnamehere), and then step away for a water or
    > >> soda.
    > >> When you come back the write should have occurred.
    > >>
    > >> --
    > >> Sincerely,
    > >>
    > >> S. Justin Gengo, MCP
    > >> Web Developer / Programmer
    > >>
    > >> www.aboutfortunate.com
    > >>
    > >> "Out of chaos comes order."
    > >> Nietzsche
    > >> "Hans Kesting" <> wrote in message
    > >> news:e%...
    > >> > OldProgrammer wrote:
    > >> >> All the documentation and discussion I have read indicate that the
    > >> >> Session_End is not supposed to fire unless you are in "inProc"
    > >> >> Session state mode, and then only on Session Timeout or at Session
    > >> >> Abandon. I need the event to fire at Session timeout in order to
    > >> >> capture and store the Datetime this occurs. However in the
    > >> >> application I am writing, I have been unable discern any indication
    > >> >> that the event is firing. I have used break points, writes to a
    > >> >> database table, and writes to a text file to indicate when this event
    > >> >> fires. So far I have got nothing back. Yet I am able to verify the
    > >> >> the session has timed out. I have no indication of code failure, but
    > >> >> nothing happens when this event is supposed to fire. I really do
    > >> >> need this so information would be hugely appreciated.
    > >> >>
    > >> >> ERJ MCSD MCDBA.
    > >> >
    > >> > You didn't specify, but when do you expect the Session_End to
    > >> > occur? It's 20 minutes (by default) after the last request for this
    > >> > session, not (as a lot of people assume) as soon as the browser
    > >> > closes or the user "navigates away".
    > >> >
    > >> > Hans Kesting
    > >> >
    > >> >
    > >>
    > >>
    > >>

    >
    >
    >
    =?Utf-8?B?T2xkUHJvZ3JhbW1lcg==?=, Sep 21, 2005
    #4
  5. I used one of our few MS support calls and got the answer direct from the
    source.


    ERJ MCSD MCDBA.
    =?Utf-8?B?T2xkUHJvZ3JhbW1lcg==?=, Sep 21, 2005
    #5
  6. Hans,

    At this point try putting a try catch around your OnSessionEnd Code.

    Try
    '---Your code here
    Catch ex As Exception
    Dim Test As String = "Place a breakpoint on this line and examine ""ex""
    if the breakpoint is hit"
    End Try

    It's possible that your code is throwing an error before any breakpoint you
    set is hit. This test may catch something.

    Otherwise please show the code for your entire OnSessionEnd (Including all
    the code even the declaration of the even handler.)


    --
    Sincerely,

    S. Justin Gengo, MCP
    Web Developer / Programmer

    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzsche
    "OldProgrammer" <> wrote in message
    news:...
    > See above my post 9/19/05 1:25 PST
    >
    > Here:
    >
    > Dim swObject As StreamWriter 'Text Stream Object
    > Dim sPath As String
    >
    > sPath = Server.MapPath("testClose.txt")
    >
    > swObject = File.CreateText(sPath)
    > swObject.Write("closing" & CStr(Now()))
    > swObject = Nothing
    >
    >
    > "S. Justin Gengo" wrote:
    >
    >> May we see your OnSessionEnd method?
    >>
    >> --
    >> Sincerely,
    >>
    >> S. Justin Gengo, MCP
    >> Web Developer / Programmer
    >>
    >> www.aboutfortunate.com
    >>
    >> "Out of chaos comes order."
    >> Nietzsche
    >> "OldProgrammer" <> wrote in
    >> message
    >> news:...
    >> > The original question specifies
    >> > 1. First tried to run needed code, then
    >> > 2. Tried to write to dB table (hardcoding all connection strings and
    >> > values), then
    >> > 3. writing to a plain vanilla text file.
    >> > 4. I tried setting the web.config file to show time out value of 2
    >> > minutes.
    >> > Then when that did not work reset it back to 20 minutes and waited one
    >> > hour.
    >> > All the seesion variables are gone and the application behaves as it is
    >> > supposed to when the session variables have been lost. The only thing
    >> > that
    >> > did not happen was the write to the DB table then text file.
    >> >
    >> > So I know the session did time out.
    >> >
    >> >
    >> > "S. Justin Gengo" wrote:
    >> >
    >> >> On top of that setting a breakpoint won't work. .NET connects to the
    >> >> web
    >> >> app
    >> >> and listens to what it's doing in order to hit breakpoints. I believe
    >> >> that
    >> >> will keep the session open.
    >> >>
    >> >> I would set a write to a database/text file inside of the session end
    >> >> handler, set your session time out to one minute (or less), compile
    >> >> the
    >> >> application, connect to it manually outside of .NET
    >> >> (http://localhost/yourappnamehere), and then step away for a water or
    >> >> soda.
    >> >> When you come back the write should have occurred.
    >> >>
    >> >> --
    >> >> Sincerely,
    >> >>
    >> >> S. Justin Gengo, MCP
    >> >> Web Developer / Programmer
    >> >>
    >> >> www.aboutfortunate.com
    >> >>
    >> >> "Out of chaos comes order."
    >> >> Nietzsche
    >> >> "Hans Kesting" <> wrote in message
    >> >> news:e%...
    >> >> > OldProgrammer wrote:
    >> >> >> All the documentation and discussion I have read indicate that the
    >> >> >> Session_End is not supposed to fire unless you are in "inProc"
    >> >> >> Session state mode, and then only on Session Timeout or at Session
    >> >> >> Abandon. I need the event to fire at Session timeout in order to
    >> >> >> capture and store the Datetime this occurs. However in the
    >> >> >> application I am writing, I have been unable discern any
    >> >> >> indication
    >> >> >> that the event is firing. I have used break points, writes to a
    >> >> >> database table, and writes to a text file to indicate when this
    >> >> >> event
    >> >> >> fires. So far I have got nothing back. Yet I am able to verify
    >> >> >> the
    >> >> >> the session has timed out. I have no indication of code failure,
    >> >> >> but
    >> >> >> nothing happens when this event is supposed to fire. I really do
    >> >> >> need this so information would be hugely appreciated.
    >> >> >>
    >> >> >> ERJ MCSD MCDBA.
    >> >> >
    >> >> > You didn't specify, but when do you expect the Session_End to
    >> >> > occur? It's 20 minutes (by default) after the last request for this
    >> >> > session, not (as a lot of people assume) as soon as the browser
    >> >> > closes or the user "navigates away".
    >> >> >
    >> >> > Hans Kesting
    >> >> >
    >> >> >
    >> >>
    >> >>
    >> >>

    >>
    >>
    >>
    S. Justin Gengo, Sep 22, 2005
    #6
    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. Ben Fidge
    Replies:
    3
    Views:
    411
    Kevin Spencer
    Oct 27, 2004
  2. Keith-Earl
    Replies:
    4
    Views:
    3,646
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
    Nov 15, 2004
  3. =?Utf-8?B?UmF2aW5kcmE=?=

    Why Response.Redirect is not working in Session_End event?

    =?Utf-8?B?UmF2aW5kcmE=?=, Nov 25, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    7,373
    Jeffrey Palermo [MCP]
    Nov 25, 2004
  4. srivalli c via DotNetMonster.com

    does Session_End event fire when the worker process recycles?

    srivalli c via DotNetMonster.com, Jun 22, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    551
  5. Replies:
    4
    Views:
    521
Loading...

Share This Page