Loading ...

Who is online?  0 guests and 0 members
home  »  blogs  »  Vivek Thakur  »  'Disable' Back Browser Button ASP.NET

Product Spotlight

ASP.NET Hosting Spotlight

 

Comments (7)

Samar
Samar said:
Hello I m putting this following code in a final page Load(the form I don't want to go back) but it is not working Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetExpires(DateTime.Now); I M using .net 2.0 framework
1/25/2010
 · 
 
by
Kev
Kev said:
Code doesn't appear to work.
10/28/2009
 · 
 
by
Paul
I tried this on ASP .NET 2.0 and it does not seem to work - where are you putting that code to get it to work?
4/10/2009
 · 
 
by
hassaanz

try this in ur logout button/link..its works for me...as it refreshs the page after the Session.abondon(); so its not possible to go bak to ur previous page without logging again..

 

protected void logOut_b_Click(object sender, ImageClickEventArgs e)
    {
        Session.Abandon();
        Response.AddHeader("Refresh",Convert.ToString((Session.Timeout * 0)));
        if(Session["Name"].ToString()=="")
        {
           Server.Transfer("login.aspx");
        }
    }

 

 

 

7/4/2010
 · 
 
by
lokesh
lokesh said:
this code doesn't work at all.. i've an appl in which when i logout i should not be able to go bak to previous page my session should end there. dont tell abt session.abandon() method this also doesn't work
12/28/2009
 · 
 
by
hassaanz

try this in ur logout button/link..its works for me...as it refreshs the page after the Session.abondon(); so its not possible to go bak to ur previous page without logging again..

 

protected void logOut_b_Click(object sender, ImageClickEventArgs e)
    {
        Session.Abandon();
        Response.AddHeader("Refresh",Convert.ToString((Session.Timeout * 0)));
        if(Session["Name"].ToString()=="")
        {
           Server.Transfer("login.aspx");
        }
    }

 

 

 

7/4/2010
 · 
 
by
Faheem
You have to put this Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetExpires(DateTime.Now); in Page_Load of final page from which u don't want to go back its working
8/28/2009
 · 
 
by

Confirm

Latest community blog posts

  • A person on the forums was struggling with jQuery tools tabs index issue on postback. On clicking the tabs and doing some postback the selected tab index was getting lost. Below is the solution on how to retaing the previous selected index which was there before postback. Complete Source: <%@ Pag...
  • I was working with jQuery tools tabs today and I had to set the initial index of tab selected by default. The solution is to set initialindex property in the options. Source: $("ul.tabs").tabs("div.panes > div", { initialIndex: 1 }) ; Complete code to test above: <html> <head> <tit...
  • A person asked me today how to get form authentication cookie and get the data present in it. I decided to write a short blog on it. Formauthentication cookie is saved with the name which we can get via FormsAuthentication.FormsCookieName property. The key here is to get the cookie via this name and...
  • While working with one of the sample application I noticed that form authentication timeout in web.config was overriding the manual ticket's (which we created via code) timeout. Below is the code which was written in the application: var ticket = new FormsAuthenticationTicket(1, "UserName", DateTime...
  • In this blog I will show how to select a range of characters in textbox with jquery. In my demo I have used one textbox and one button. On click of button arange of characters in textbox will be selected. Below is the sample code: <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="ser...

Vivek Thakur's latest blog posts

Product Spotlight

ASP.NET Hosting Spotlight

 

Quick Vote

What kind of email newsletter would you prefer to receive from CodeAsp.Net?