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

i am using asp.net by using c# code. While i am testing application i observe scenario that i have mention below.

I am login the application, after successful login i had redirect to home page. while i am on home page and i had click on browser "back" button. On click on back button i had redirect to application login page. while i am on login page and click on browser "froward" button. On click on "Froward" button i had directly redirected to the home page without login.

I am try to restrict user. Please provide me any solution on the same.

For application i use Master page for Menu reaming are content pages except login and logout.
Thanks in advance

Regards,
Chetan C
Posted
Updated 29-Apr-15 3:56am
v2

1 solution

You're seeing this as the pages are being retrieved from the browser cache so your code (including authentication checks) isn't running. You can stop this by disabling caching on pages you want the user to be authenticated to access (google for how to disable caching on an aspx page), but it will adversely affect the performance of your site and increase resource usage so it's up to you to decide if it is worth it. After all when the person goes back\forward they are simply seeing things they have already seen, so who cares?

You can't stop people using back\forward though, it's the wrong tree to be barking up.
 
Share this answer
 
Comments
Sascha Lefèvre 29-Apr-15 10:30am    
+5
Sergey Alexandrovich Kryukov 29-Apr-15 10:36am    
Good point, about a tree. It's possible though.
5ed.
—SA
Chetan Chopkar 30-Apr-15 3:09am    
Hi,

Thanks for reply,

I am using below mention code for remove browse cache, still it not work for me.

Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.UtcNow.AddHours(-1));
Response.Cache.SetNoStore();

if do you have another solution then please let me know.

Thanks
F-ES Sitecore 30-Apr-15 6:21am    
What page is that code on?
Chetan Chopkar 13-May-15 6:37am    
on Master.cs page

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



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