Last post Jan 23, 2017 08:36 AM by Zhi Lv - MSFT
Jan 21, 2017 02:25 PM|vannessalow|LINK
In my asp.net application user login is available. After user logged out and if pressed the back button it goes to the previously visited page. I need to control the user to again login to enter into the website. How to solve this problem. I writing
code in c#.
this is my logout cs code
public partial class UserLogoutPage : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
Jan 21, 2017 02:37 PM|markfitzme|LINK
That's because the page is cached and going back doesn't necessarily create a new request. Try adding:
<meta HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
To the top of the page in the header section of the browser. This helps identify the page as being uncacheable.
Jan 21, 2017 02:55 PM|vannessalow|LINK
may i know at which line should i add?
I have an error saying "The type or namespace name 'meta' could not be found. Help is appreciated, thanks!
Jan 21, 2017 05:31 PM|mohtshm|LINK
You 've to put this meta in markup file i.e. .aspx not the .aspx.cs under
Jan 22, 2017 05:57 AM|vannessalow|LINK
Hi, do i put it at login.aspx or logout.aspx or homepage.aspx? please advise thanks
Jan 22, 2017 08:06 AM|mohtshm|LINK
If your whole site is only allow authorized user then
I think master page is best
Jan 23, 2017 08:36 AM|Zhi Lv - MSFT|LINK
Prevent user from going back to data after logging out asp.net c#
If you are using Form Authentication, I suggest you could refer to the following code,
private void Page_Load(object sender, System.EventArgs e)
// Put user code to initialize the page here
More details, see:
Besides, I suggest you could also refer to this article: