Click here to Skip to main content
15,891,707 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

how to show a messages as 'session out' in login page if prevent seeing previous
page after logout?


Thanks in advance..
Posted

Check whethere session exists in your login page or not. If Session got expires print on Label or MessageBox.Show("Session Expired");
Thanks
 
Share this answer
 
hi,
Please refer below link for your req.

Alert Session Time out in ASP.NET[^]

hope this will help you. please mark as answer if this helps you.

thanks,
kk
 
Share this answer
 
In one of my project the user wanted to have the similar functionality(If a user logs out the application and clicks the back button a message had to be shown that the session is expired). for this we configured the pages not to be stored in cache. Also on page load event we checked that if the session is empty the user will be logged out by using Response.Redirect() method with a query string variable representing the attempt to access the page without logging in. So you may use a query string variable while redirecting to the login page. If this page is accessed without query string variable, it means the user is logging in the application first time. If query string variable exist, it means the user is trying to access the page without logging in. Same thing can be done if the user clicks on log out button. I hope this may clear your doubt.
 
Share this answer
 
Comments
hasbina 21-Dec-12 7:53am    
Thanks a lot...
hasbina 22-Dec-12 0:38am    
Thanks a lot sir...
Zafar Sultan 24-Dec-12 3:36am    
That's OK but did it solve your problem?
hasbina 23-Mar-13 7:57am    
yes
I think you mean you want to use meta tags to tell your page not to cache. Google 'html page no cache'
 
Share this answer
 
Comments
hasbina 20-Dec-12 2:11am    
@Christian
sorry sir,don't get idea..
hasbina 20-Dec-12 2:15am    
i successfully implemented the code to prevent seeing previous page after logout.
i want to show a message in login page.
Zafar Sultan 20-Dec-12 4:25am    
Since you are already done with the code implementation, can you elaborate on what condition you want to show message(for example: clicking on back button or user pasting the page's url in the browser's address bar)?
hasbina 21-Dec-12 5:44am    
@zafar sultan
sir, clicking on back button.
Christian Graus 21-Dec-12 15:14pm    
You can't detect or add code to deal with the back button. It just creates a request. Any code to try to change what it does, can be defeated. You can modify the code that is often posted on the net to defeat the back button to instead redirect to the current URL plus a parameter, but not if you expect it to always work, not if it's for security.

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