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

  • Well this is really not my last post but I will not be blogging anymore here to avoid cross posting of contents. Instead you can visit my official blog at: Vinz' Blog Note: Stop blogging here doesn't mean I will stop contributing to the codeasp community, of course I will still be moderating posts a...
  • We were stuck with a weird issue. Our ASP.NET web app was crashing for some reason and the event log only displayed Stackoverflow exception. We want to narrow down the reason for the crash and since stackoverflow exceptions are easy to debug (even crash dumps didnt give help much), we wanted our app...
  • The default SqlCommand timeout is 30 seconds, so you might get this error while executing a lengthy Sql operation (like creating a DB and its schema via C# code): Error : Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. In order to fix...
  • We had created a Visual Studio project in C# to create SQL Server 2005 database via C# code. We were referencing these assemblies: Microsoft.SqlServer.Management.Sdk.Sfc.dll Microsoft.SqlServer.Smo.dll Microsoft.SqlServer.ConnectionInfo.dll We also added this DLL but did not reference it as we reali...
  • This year again, Macedonian .NET User Group is organizing the biggest event in balkans... CODE CAMP 2011 Event will be held at 26th of November at FON University, Skopje, Macedonia. There are 24 speakers, 7 MVPs, 25 sessions and 5 tracks. In the first 15 hours we got 600 registered attendees... and ...

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?