Session_End not firing

Discussion in 'ASP .Net' started by Calvin Willman, Mar 2, 2006.

  1. ASP.NET 2.0, Visual Web Developer Express

    I've written a web app, which creates a Gif to display on the page. I name
    it [SessionID].gif, and only want it to last as long as the session, so I've
    included

    File.Delete([filepath]) in the Session_End event, but this never seems to
    run. I've set break points which are never reached...

    I've added <sessionState mode="InProc" /> to the web.config file...

    what's the problem??

    Thanks in advance
     
    Calvin Willman, Mar 2, 2006
    #1
    1. Advertising

  2. Calvin Willman

    Hans Kesting Guest

    Re: =?UTF-8?B?U2Vzc2lvbl9FbmQgbm90IGZpcmluZw==?=

    > ASP.NET 2.0, Visual Web Developer Express
    >
    > I've written a web app, which creates a Gif to display on the page. I name it
    > [SessionID].gif, and only want it to last as long as the session, so I've
    > included
    >
    > File.Delete([filepath]) in the Session_End event, but this never seems to
    > run. I've set break points which are never reached...
    >
    > I've added <sessionState mode="InProc" /> to the web.config file...
    >
    > what's the problem??
    >
    > Thanks in advance


    When do you expect that Session_End to run?

    It will run when the session times out, which is by default 20 minutes
    after the last page has been requested.

    Hans Kesting
     
    Hans Kesting, Mar 2, 2006
    #2
    1. Advertising

  3. Thanks for your reply Hans,
    I'm expecting it to run when the user closes the browser...

    It's strange. I think it's working, but it's taking roughly 3 minutes for
    the image to actually disappear from the folder. Also, the break point is
    never encountered.

    I've been testing including the <sessionState> element in the web.config
    file in the Windows\Microsoft.Net\Config folder and I think it is that which
    is making it work, rather than the application's web.config file. Infact I'm
    pretty sure it's only working if I put it in the Windows directory.

    It's very annoying, as using Session_End was fine in VS 2003.

    "Hans Kesting" <> wrote in message
    news:...
    >> ASP.NET 2.0, Visual Web Developer Express
    >>
    >> I've written a web app, which creates a Gif to display on the page. I
    >> name it [SessionID].gif, and only want it to last as long as the session,
    >> so I've included
    >>
    >> File.Delete([filepath]) in the Session_End event, but this never seems to
    >> run. I've set break points which are never reached...
    >>
    >> I've added <sessionState mode="InProc" /> to the web.config file...
    >>
    >> what's the problem??
    >>
    >> Thanks in advance

    >
    > When do you expect that Session_End to run?
    >
    > It will run when the session times out, which is by default 20 minutes
    > after the last page has been requested.
    >
    > Hans Kesting
    >
    >
     
    Calvin Willman, Mar 2, 2006
    #3
  4. Calvin Willman

    Ray Booysen Guest

    You'll never get it to fire when the browser closes as IIS cannot know
    when this happens. It fires when the session expires or is explicitly
    closed.

    I don't understand because you are seeing the correct behavior after 3
    minutes. Isn't this what you want?

    Regards
    Ray

    Calvin Willman wrote:
    > Thanks for your reply Hans,
    > I'm expecting it to run when the user closes the browser...
    >
    > It's strange. I think it's working, but it's taking roughly 3 minutes for
    > the image to actually disappear from the folder. Also, the break point is
    > never encountered.
    >
    > I've been testing including the <sessionState> element in the web.config
    > file in the Windows\Microsoft.Net\Config folder and I think it is that which
    > is making it work, rather than the application's web.config file. Infact I'm
    > pretty sure it's only working if I put it in the Windows directory.
    >
    > It's very annoying, as using Session_End was fine in VS 2003.
    >
    > "Hans Kesting" <> wrote in message
    > news:...
    >>> ASP.NET 2.0, Visual Web Developer Express
    >>>
    >>> I've written a web app, which creates a Gif to display on the page. I
    >>> name it [SessionID].gif, and only want it to last as long as the session,
    >>> so I've included
    >>>
    >>> File.Delete([filepath]) in the Session_End event, but this never seems to
    >>> run. I've set break points which are never reached...
    >>>
    >>> I've added <sessionState mode="InProc" /> to the web.config file...
    >>>
    >>> what's the problem??
    >>>
    >>> Thanks in advance

    >> When do you expect that Session_End to run?
    >>
    >> It will run when the session times out, which is by default 20 minutes
    >> after the last page has been requested.
    >>
    >> Hans Kesting
    >>
    >>

    >
    >



    --
    Ray Booysen
     
    Ray Booysen, Mar 2, 2006
    #4
  5. In addition to what Ray said, if you search the newsgroups you will find
    hundreds of posts identical to yours, and responses to those posts that
    explain all the various reasons why this cannot happen.

    "Calvin Willman" <> wrote in message
    news:...
    > Thanks for your reply Hans,
    > I'm expecting it to run when the user closes the browser...
    >
    > It's strange. I think it's working, but it's taking roughly 3 minutes for
    > the image to actually disappear from the folder. Also, the break point is
    > never encountered.
    >
    > I've been testing including the <sessionState> element in the web.config
    > file in the Windows\Microsoft.Net\Config folder and I think it is that
    > which is making it work, rather than the application's web.config file.
    > Infact I'm pretty sure it's only working if I put it in the Windows
    > directory.
    >
    > It's very annoying, as using Session_End was fine in VS 2003.
    >
    > "Hans Kesting" <> wrote in message
    > news:...
    >>> ASP.NET 2.0, Visual Web Developer Express
    >>>
    >>> I've written a web app, which creates a Gif to display on the page. I
    >>> name it [SessionID].gif, and only want it to last as long as the
    >>> session, so I've included
    >>>
    >>> File.Delete([filepath]) in the Session_End event, but this never seems
    >>> to run. I've set break points which are never reached...
    >>>
    >>> I've added <sessionState mode="InProc" /> to the web.config file...
    >>>
    >>> what's the problem??
    >>>
    >>> Thanks in advance

    >>
    >> When do you expect that Session_End to run?
    >>
    >> It will run when the session times out, which is by default 20 minutes
    >> after the last page has been requested.
    >>
    >> Hans Kesting
    >>
    >>

    >
    >
     
    Marina Levit [MVP], Mar 2, 2006
    #5
  6. The correct behavious only occurs if <sessionstate> element is in web.config
    in Windows directory.

    So... if I publish this to a remote site, I'm wondering if I'm going to have
    problems as I won't have access to amend this file to make sure the correct
    mode is in place on the webserver.

    I'll have to think of something else... maybe sweep the folder to delete
    files over a certain date.

    The image is a proof of a business card, that a user will order or not... I
    suppose I could set it to delete once the order is placed.

    Thanks anyway for all your comments.

    "Ray Booysen" <> wrote in message
    news:u%...
    > You'll never get it to fire when the browser closes as IIS cannot know
    > when this happens. It fires when the session expires or is explicitly
    > closed.
    >
    > I don't understand because you are seeing the correct behavior after 3
    > minutes. Isn't this what you want?
    >
    > Regards
    > Ray
    >
    > Calvin Willman wrote:
    >> Thanks for your reply Hans,
    >> I'm expecting it to run when the user closes the browser...
    >>
    >> It's strange. I think it's working, but it's taking roughly 3 minutes for
    >> the image to actually disappear from the folder. Also, the break point is
    >> never encountered.
    >>
    >> I've been testing including the <sessionState> element in the web.config
    >> file in the Windows\Microsoft.Net\Config folder and I think it is that
    >> which is making it work, rather than the application's web.config file.
    >> Infact I'm pretty sure it's only working if I put it in the Windows
    >> directory.
    >>
    >> It's very annoying, as using Session_End was fine in VS 2003.
    >>
    >> "Hans Kesting" <> wrote in message
    >> news:...
    >>>> ASP.NET 2.0, Visual Web Developer Express
    >>>>
    >>>> I've written a web app, which creates a Gif to display on the page. I
    >>>> name it [SessionID].gif, and only want it to last as long as the
    >>>> session, so I've included
    >>>>
    >>>> File.Delete([filepath]) in the Session_End event, but this never seems
    >>>> to run. I've set break points which are never reached...
    >>>>
    >>>> I've added <sessionState mode="InProc" /> to the web.config file...
    >>>>
    >>>> what's the problem??
    >>>>
    >>>> Thanks in advance
    >>> When do you expect that Session_End to run?
    >>>
    >>> It will run when the session times out, which is by default 20 minutes
    >>> after the last page has been requested.
    >>>
    >>> Hans Kesting
    >>>
    >>>

    >>
    >>

    >
    >
    > --
    > Ray Booysen
    >
     
    Calvin Willman, Mar 2, 2006
    #6
  7. Actually, that's not true... it works with the application web.config as
    well, but it's just a little unpredicably..

    I'm a little hungover today so that's probably not helping.

    "Calvin Willman" <> wrote in message
    news:usv$...
    > The correct behavious only occurs if <sessionstate> element is in
    > web.config in Windows directory.
    >
    > So... if I publish this to a remote site, I'm wondering if I'm going to
    > have problems as I won't have access to amend this file to make sure the
    > correct mode is in place on the webserver.
    >
    > I'll have to think of something else... maybe sweep the folder to delete
    > files over a certain date.
    >
    > The image is a proof of a business card, that a user will order or not...
    > I suppose I could set it to delete once the order is placed.
    >
    > Thanks anyway for all your comments.
    >
    > "Ray Booysen" <> wrote in message
    > news:u%...
    >> You'll never get it to fire when the browser closes as IIS cannot know
    >> when this happens. It fires when the session expires or is explicitly
    >> closed.
    >>
    >> I don't understand because you are seeing the correct behavior after 3
    >> minutes. Isn't this what you want?
    >>
    >> Regards
    >> Ray
    >>
    >> Calvin Willman wrote:
    >>> Thanks for your reply Hans,
    >>> I'm expecting it to run when the user closes the browser...
    >>>
    >>> It's strange. I think it's working, but it's taking roughly 3 minutes
    >>> for the image to actually disappear from the folder. Also, the break
    >>> point is never encountered.
    >>>
    >>> I've been testing including the <sessionState> element in the web.config
    >>> file in the Windows\Microsoft.Net\Config folder and I think it is that
    >>> which is making it work, rather than the application's web.config file.
    >>> Infact I'm pretty sure it's only working if I put it in the Windows
    >>> directory.
    >>>
    >>> It's very annoying, as using Session_End was fine in VS 2003.
    >>>
    >>> "Hans Kesting" <> wrote in message
    >>> news:...
    >>>>> ASP.NET 2.0, Visual Web Developer Express
    >>>>>
    >>>>> I've written a web app, which creates a Gif to display on the page. I
    >>>>> name it [SessionID].gif, and only want it to last as long as the
    >>>>> session, so I've included
    >>>>>
    >>>>> File.Delete([filepath]) in the Session_End event, but this never seems
    >>>>> to run. I've set break points which are never reached...
    >>>>>
    >>>>> I've added <sessionState mode="InProc" /> to the web.config file...
    >>>>>
    >>>>> what's the problem??
    >>>>>
    >>>>> Thanks in advance
    >>>> When do you expect that Session_End to run?
    >>>>
    >>>> It will run when the session times out, which is by default 20 minutes
    >>>> after the last page has been requested.
    >>>>
    >>>> Hans Kesting
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>
    >> --
    >> Ray Booysen
    >>

    >
    >
     
    Calvin Willman, Mar 2, 2006
    #7
    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. Chris Sibel

    Session_End Not Firing

    Chris Sibel, Jul 2, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    2,019
    Naveen K Kohli
    Jul 2, 2003
  2. Steve M
    Replies:
    5
    Views:
    580
    Yan-Hong Huang[MSFT]
    Jul 31, 2003
  3. Stig Johansen

    Session_End not firing or limited?

    Stig Johansen, Dec 5, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    1,784
    Jim Cheshire [MSFT]
    Dec 5, 2003
  4. JezB

    Session_End never firing

    JezB, Jul 6, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    411
    Marina
    Jul 6, 2004
  5. Jeremy

    Session_End Event Always Firing

    Jeremy, Dec 3, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    500
    Kevin Spencer
    Dec 3, 2005
Loading...

Share This Page