Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redirect after session timeout. 3

Status
Not open for further replies.

shangrilla

Programmer
Nov 21, 2001
360
US
Hi:

How can I redirect the users back to the login page after the session has timed out?

Thanks
 
How are you implementing your authentication scheme?

If your using forms authentication which it sounds like you are then once the session times out the Request.IsAuthenticated property will be false. If your using a separate secure folder with the web.config file set to only allow authenticated users, then they will be automatically redirected to the specified login page.

Once you describe how you have implemented your authentication scheme I will be able to better help you.

That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Yes I am using Forms authentications.
So in the .aspx.vb file under the "Web Form Generated Code"
section if I put:
If Request.IsAuthenticated = False Then
Response.Redirect("login.aspx", true)
End If
this should do it, Correct?

Do I need to have this in every web form or can I just put this in one location?

How I can set the target of the redirected page?
 
If you haven't set your site up in the following way then you will need to put that exact code into your page_load routine for each page. However, if you have set up your authentication scheme to secure a directory then anyone asking for a page in that directory will need to be authenticated(the framework checks this for you) If they are not then they are automatically redirected to the login page and after they have logged in the user is then redirected back to the page he/she first requested.

A concept of this can be found here
If you still are having trouble I'll be around.

That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
<forms name=&quot;.DirectCookie&quot; loginUrl=&quot;/login.aspx&quot; protection=&quot;All&quot; timeout=&quot;1&quot; path=&quot;/&quot;/>


How can I set the target frame for loginUrl?
 
Just throwing this out:

couldn't you also perform a

Response.Redirect(&quot;login.aspx&quot;)

in the session_OnEnd() sub in Global?

(so that way if they still have a browser window open, the browser is redirecting, and if not...well, nothing happens)

D
 
O look here comes Jack in all his glory.
j/k Jack I think that would work perfectly well.

shangrilla I don't think you can set the target frame using this method of authentication.

That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
I feel pretty darn good because I added Response.Redirect(&quot;login.aspx&quot;)in the session_OnEnd() sub in Global.asax before checking this thread. I wasn't sure if that was going to work, but now after expert opinions I have confidence that it'll be alright.

Can I set the target frame in:
Response.Redirect(&quot;login.aspx&quot;)

Thanks
 
nope you cannot. the redirect method is a serverside method and doesn't even know what a frame is unfortunately.

That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top