Click here to Skip to main content
16,004,782 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionAuto Logout ...please tell me the Answer Pin
pkravikumar1-Nov-09 20:44
pkravikumar1-Nov-09 20:44 
AnswerRe: Auto Logout ...please tell me the Answer Pin
Christian Graus1-Nov-09 20:46
protectorChristian Graus1-Nov-09 20:46 
GeneralRe: Auto Logout ...please tell me the Answer Pin
Gaurav Dudeja India1-Nov-09 20:50
Gaurav Dudeja India1-Nov-09 20:50 
GeneralRe: Auto Logout ...please tell me the Answer Pin
Christian Graus1-Nov-09 20:51
protectorChristian Graus1-Nov-09 20:51 
AnswerRe: Auto Logout ...please tell me the Answer Pin
Christian Graus1-Nov-09 20:52
protectorChristian Graus1-Nov-09 20:52 
GeneralRe: Auto Logout ...please tell me the Answer Pin
Shameel1-Nov-09 23:21
professionalShameel1-Nov-09 23:21 
AnswerRe: Auto Logout ...please tell me the Answer Pin
Imran Khan Pathan1-Nov-09 21:04
Imran Khan Pathan1-Nov-09 21:04 
AnswerRe: Auto Logout ...please tell me the Answer Pin
Abhishek Sur1-Nov-09 21:13
professionalAbhishek Sur1-Nov-09 21:13 
Hey pkravikumar,

Let me suggest what I do in your situation.
1. I would make an HTTPHandler which redirects every request for ASPX extension.
2. Whenever User Logs in to my system, I would store the UserData in Session using a SessionKey. For example :

if (Session["ID"] == null))
context.Session.Add("ID", userid); // you may have any value here.


3. On every request I would check whether the requested Url leads to Login page or anyother page. If any other page, is the user Logged in already.
if (Session["ID"] == null && Request.Url.AbsolutePath != loginurl)
{
  Response.Write("<script type=\"text/javascript\">var w = window.parent || window; w.location='" + loginurl + "';</script>");
 Response.Flush();
 Response.End();
}


This will also eliminate your problem. If session Timeout occurs, Session["ID"] will have null in it. Thus any other request to page other than loginurl will lead to redirect it to loginurl.

I hope you like this solution.
Other than that, If you dont want to write a Handler and want to do this in pages, you can see this url :
Detecting Session Timeouts[^]

Here you will find how to detect new session. Smile | :)
Thumbs Up | :thumbsup: Rose | [Rose]

Abhishek Sur
Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->

Microsoft Bing MAP using Javascript
CLR objects in SQL Server 2005
Uncommon C# Keywords
/xml>

Questioncommand line to print Pin
ptvce1-Nov-09 20:27
ptvce1-Nov-09 20:27 
AnswerRe: command line to print Pin
Christian Graus1-Nov-09 20:28
protectorChristian Graus1-Nov-09 20:28 
GeneralRe: command line to print Pin
ptvce1-Nov-09 20:44
ptvce1-Nov-09 20:44 
GeneralRe: command line to print Pin
Christian Graus1-Nov-09 20:45
protectorChristian Graus1-Nov-09 20:45 
QuestionIs there a difference between Serial Port and USB in ASP.net Pin
Liya Kebede1-Nov-09 20:20
Liya Kebede1-Nov-09 20:20 
AnswerRe: Is there a difference between Serial Port and USB in ASP.net Pin
Christian Graus1-Nov-09 20:28
protectorChristian Graus1-Nov-09 20:28 
GeneralRe: Is there a difference between Serial Port and USB in ASP.net Pin
Liya Kebede1-Nov-09 20:44
Liya Kebede1-Nov-09 20:44 
GeneralRe: Is there a difference between Serial Port and USB in ASP.net Pin
Christian Graus1-Nov-09 20:49
protectorChristian Graus1-Nov-09 20:49 
GeneralRe: Is there a difference between Serial Port and USB in ASP.net Pin
Liya Kebede1-Nov-09 20:56
Liya Kebede1-Nov-09 20:56 
GeneralRe: Is there a difference between Serial Port and USB in ASP.net Pin
Christian Graus1-Nov-09 21:16
protectorChristian Graus1-Nov-09 21:16 
GeneralRe: Is there a difference between Serial Port and USB in ASP.net Pin
Liya Kebede1-Nov-09 21:51
Liya Kebede1-Nov-09 21:51 
QuestionParser error Pin
RajpootRohan1-Nov-09 19:17
professionalRajpootRohan1-Nov-09 19:17 
AnswerRe: Parser error Pin
Christian Graus1-Nov-09 20:02
protectorChristian Graus1-Nov-09 20:02 
QuestionHow to Fix the Log Errors. Pin
Johndas1-Nov-09 19:03
Johndas1-Nov-09 19:03 
Questionsize of attach file Pin
ptvce1-Nov-09 18:51
ptvce1-Nov-09 18:51 
AnswerRe: size of attach file Pin
dan!sh 1-Nov-09 18:57
professional dan!sh 1-Nov-09 18:57 
AnswerRe: size of attach file Pin
Sandesh M Patil27-Apr-10 0:43
Sandesh M Patil27-Apr-10 0:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.