Click here to Skip to main content
15,888,733 members
Please Sign up or sign in to vote.
1.32/5 (4 votes)
See more:
plz help me out, i can not sleep whole night.
Posted
Comments
Thanks7872 1-Oct-13 5:23am    
Do you think this is the right way of asking the question? No details. just asp.net and javascript is not enough. Not clear at all.
Sampath Kumar Sathiya 1-Oct-13 5:59am    
Hi,

Try to write the logout code in Session_End event in global.asax (This will work only when Inproc session mode).

You can check this link if not opting to use the Session_End event
http://stackoverflow.com/questions/1824421/detect-browser-close-on-asp-net[^]

Hope this helps...
 
Share this answer
 
Comments
arvind bisht 2-Oct-13 10:26am    
how this works, b'coz my idle time for logout is 20minute
JoCodes 2-Oct-13 10:55am    
whats your session mode?
JoCodes 2-Oct-13 11:17am    
check this http://www.codeproject.com/Tips/154801/How-to-end-user-session-when-browser-closed
im master page code behind, write the condition as:

void Session_Start(object sender, EventArgs e)
{
Session["UserID"] = "";
}

kindly write this code in the global.asax

//this code will only execute when you will request for the page. it will execute only once. when user will close the browser, without logout, and when that user will come again at that time this code will reset the user's session.
This will solve your problem.
on master page load you can check,

if(session[UserID]!="")
{
// code for the login
}
//------------------------------
Thank you.
 
Share this answer
 
Comments
arvind bisht 1-Oct-13 8:14am    
thanks buddy

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900