By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,908 Members | 2,055 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,908 IT Pros & Developers. It's quick & easy.

smart way to set "timeout" security

P: 31
hi all,

I am developing a system using asp.net(c#). I am using "left" "top" & "Middle" design in my system. I want to set a time out mechanism. when the user has expired the configured time the user is derected to a tomeout mesassage page.

at the moment i am using fillowing code in page load metod in all middle pages.

if (Session["UserId"] != null)
{
if (!IsPostBack)
{
////
//// necessry methods
////
}
}

else
{
Server.Transfer("TimeOutMessage.aspx");

}


can anyone propose another smart way to do this?

Thanx

Anushka
Oct 12 '07 #1
Share this Question
Share on Google+
1 Reply


Shashi Sadasivan
Expert 100+
P: 1,435
Hi,
Your code is almost pretty much necessary for each page that you create (except the login screen ofcourse)
You dont want people to bookmark pages and think that they can just get in without logging in later on.

To expire a session you can set its properties during the time you create the session. So the moment the session expires it would become null and then any postback even being triggered would transfer the user to the login page
Oct 12 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.