Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 16th, 2009, 05:50 AM
Authorized User
 
Join Date: Jun 2005
Location: , , Philippines.
Posts: 97
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to aldwinenriquez
Default Redirecting to a different page during session expiration

I am using forms authentication and whenever a session expires, it is automatically redirected to the loginurl.

Is there a way for me to redirect session timeouts to a different page and only unauthenticated requests to the loginurl?
__________________
\"Dont you ever give up!\"
  #2 (permalink)  
Old April 16th, 2009, 02:04 PM
Friend of Wrox
Points: 2,101, Level: 18
Points: 2,101, Level: 18 Points: 2,101, Level: 18 Points: 2,101, Level: 18
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2003
Location: , , .
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
Default

Quote:
Originally Posted by aldwinenriquez View Post
I am using forms authentication and whenever a session expires, it is automatically redirected to the loginurl.

Is there a way for me to redirect session timeouts to a different page and only unauthenticated requests to the loginurl?

I'm sure there is. I'm not sure I understand the question or maybe don't have enough information. If your code is redirecting on session timeout, why not just point it to another page in that place, instead of to the login page?

Not sure I really understand the problem.

Richard
  #3 (permalink)  
Old April 16th, 2009, 08:52 PM
Authorized User
 
Join Date: Jun 2005
Location: , , Philippines.
Posts: 97
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to aldwinenriquez
Default

Which event is for the session timeout.
I tried using Session_End event implemented in an HttpModule and used Response.Redirect("SomePage") but never worked.

or, where should i put the redirection code?
__________________
\"Dont you ever give up!\"
  #4 (permalink)  
Old April 16th, 2009, 09:58 PM
Friend of Wrox
Points: 2,101, Level: 18
Points: 2,101, Level: 18 Points: 2,101, Level: 18 Points: 2,101, Level: 18
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2003
Location: , , .
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
Default

On my login page I assign a Session variable to the user.

Something like Session("UserID")

In the include file for the menu header on every page I have this code:

If Len(Session("UserID")) = 0 Then
Response.Redirect("/logout.asp")
End If

If their session has timed out then the length of that session variable will be 0. In this case I redirect to a logout page and run this code just to make sure everything is cleared out.

Session.Contents.RemoveAll()
Session.Abandon()
Response.Redirect("/default.asp?url=" & Server.UrlEncode(Request("URL")))

which redirects back to the login page.

You could do somewhat the same thing and redirect timed out sessions anywhere you want.

Richard
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
TIP: Redirecting when session expires jimibt BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 5 November 16th, 2007 05:42 AM
Redirecting Page With Alert arnabghosh Classic ASP Professional 0 November 8th, 2007 02:43 AM
Session expiration manoj_k79 Classic ASP Basics 1 October 13th, 2006 07:19 AM
Page Redirecting venkatagiri ASP.NET 2.0 Basics 0 June 22nd, 2006 06:17 AM
Page Expiration? Thagi ASP.NET 1.x and 2.0 Application Design 2 March 7th, 2006 12:12 AM



All times are GMT -4. The time now is 05:33 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.