sessions in asp.net?
HI,
In my application i am using session so that if user login the user id will store in a session basing on this session he see the his account if session is not (empty) again he redirect to login page. it is working fine but in log-out button开发者_开发问答 i am assigning the empty value to sessions (session ["id"]= "";) and redirect to login page.it is also working fine but when i press back button of browser again it is going to back to the page, it should not like that. when press back button it is should redirect to login page only. can u help in this thank you.
When the user presses the Back button on his browser there's no request being performed to the web server but the page is served from the browser cache. This means that the only way to prevent this is to have all your authenticated pages set a no cache header so that the HTML is not stored in the browser cache:
Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();
精彩评论