void Session_End(object sender, EventArgs e)

Posted on 2006-03-30
Last Modified: 2010-05-18
Hi All

I am handling the session end and want to redirect the browser.

I am doing Server.transfer("somewhere");  but an exception is thrown.

Anyone know how i can redirect a user from in here?? ;)

Response.redirect throw exception as well....


Question by:osiris247
    LVL 22

    Accepted Solution


    I found this on the web which should answer your question as to why it's not working:

    Q: How come Response.Redirect and Server.Transfer is not working in Session_End?
    A: Session_End is fired internally by the server, based on an internal timer. Thus, there is no HttpRequest associted when that happens. That is why Response.Redirect or Server.Transferdoes not make sense and will not work.

    That information came from the following article by Peter Bromberg:

    Basically, you'll have to find another way to implement this.  There are a lot of solutions out there, I'll throw a couple at you:

    This article uses a base page, which in .NET 2.0 you could substitute for a MasterPage:

    Meta Refresh (good method):

    Good luck and let me know if you have any questions.
    -- Jason
    LVL 7

    Author Comment

    Thanks Jason....
    4Guys from Rolla do it again. :)

    Thanks for responding.


    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now