[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2259
  • Last Modified:

void Session_End(object sender, EventArgs e)

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....

??

thanks
o
0
osiris247
Asked:
osiris247
1 Solution
 
Jason ScolaroCommented:
osiris247,

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:
http://www.eggheadcafe.com/articles/20021016.asp

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:
http://www.eggheadcafe.com/articles/20021016.asp

Meta Refresh (good method):
http://www.codeproject.com/useritems/ASpNet_Page_redirecting.asp

http://www.4guysfromrolla.com/webtech/tips/t022800-1.shtml

Good luck and let me know if you have any questions.
-- Jason
0
 
osiris247Author Commented:
Thanks Jason....
4Guys from Rolla do it again. :)

Thanks for responding.

o
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now