-----------------------------------------------------------
New Message on MumbaiUserGroup
-----------------------------------------------------------
From: saurabhdotnet
Message 4 in Discussion
Hi ! Rajesh,
I am showing you two techniques. Which one is the most suitable, you can use
that .
1) Redirecting User To Login Page after Session Timeouts :
Redirecting user to login page after session timeout is similar to
refreshing the page after certain intervals method. Only thing which will
differ is that calculating time after which the page has to be redirected.
Hence time can be calculated using Session.timeout property which will give
us session timeout value for that session. Add some grace timings to that
value and redirect the user to the login page automatically.
Using Window.setTimeout method
body.Attributes.Add("onLoad",
"window.setTimeout(""window.location.href='login.aspx'""," &
(Session.Timeout * 60 * 1000) + 10000 & ");")
Using Meta Tag - Refresh
Response.AppendHeader("Refresh", Convert.ToString((Session.Timeout * 60) +
10) & "; URL=Login.aspx")
Both these methods will redirect the user to login page after session
timeout + 10 seconds. This is how you can redirect the user to login page
after session timeout without user interaction.
2) I implemented the following solution:
- on each webpage is a hidden field
- this field is set in Page_Load
- before setting this field a Session variable is checked for availability
if not then timeout is assumed,
the session variable can be reloaded from the hidden field
now it is possible safely close the connection
I couldn't find a case in which the second solution did not work. Hope, this
helps you out too. Feel free in case of any queries. Your suggestions are
always invited.
!! Happy Coding .NET !!
Regards,
Saurabh Verma
(let's rock the world with the power of .NET)
Microsoft Certified Trainer for .NET
Microsoft Certified Solution Developer for .NET(EA)
Microsoft Certified Database Administrator for 2003
_________________________________________________________________
Watching a pirated movie? Stop now!
http://server1.msn.co.in/Computing/antipiracy/movies.html Say no to piracy!
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/mumbaiusergroup/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]