Click here to Skip to main content
16,021,125 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi guys,

I doing a one project in this i using a Forms Authentication. In this once user is Logout dont go to a back and forward pages. I using one method it is working on Mozilla but not in chrome and IE.
I using this method
Response.Cache.SetNoStore();
Please Help me.

Advance in thanks
Posted

Take a look at this Tip/Trick

Browser back button issue after logout[^]
 
Share this answer
 
Hope this[^] also might help you.
 
Share this answer
 
Hope this Helps:

Step1->The best way to add logout button in your master page instead of each page in your application

Demonstration:- <asp:LinkButton ID="lnk" runat="server" Text="Logout" ForeColor="white"
onclick="lnk_Click" CausesValidation="false"></asp:LinkButton>


Step2-> Now remove the session from cache, To do it, write the following code in page_load event of your master page in which you have logout button.

Demonstration:-

protected void Page_Load(object sender, EventArgs e)

{
Response.Cache.SetCacheability(HttpCacheability.NoCache);
}


Step3-> Now write the following code in click event of link button

Demonstration:-

protected void lnk_Click(object sender, EventArgs e)

{

Session.Abandon();
Response.Redirect("~/Home.aspx");

}


After performing all these steps your logout button will perform fine,
If you want to make more secure of your web application then you need to add Global.asax file in your web application. We define an event in this file that will perform globally and provide security from intruders.

Step1-> *Right click on your web application .
*Add new item.
*Add Global.asax file.

Step2-> Write a function in your Global.asax file as mention below.

void session_start()
{
if (Session["usr"] == null)
{
Response.Redirect("~/Home.aspx");
//Here you can write the address of your home page or index page
// Or which you want to make start page.
}
}
 
Share this answer
 
Comments
praveenkatkuri 14-Jul-11 7:34am    
Thansk You

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