.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

After logout is done check is made so that the browser back button does not retun to the last visite

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :JQuery

Why this code not working.I want after logout is done check  the browser back button does not retun to the last visited page.

please help me.

 <script language = "javascript" type = "text/javascript">

         -- After LOGOUT is done,check is made so that the browser back button
         does not retun to the last visited page.
         -- The below function is called in OnClientClick of Login button
         function SetLogoutCookie(value) {
             var exdate = new Date();
             exdate.setDate(exdate.getDate() + 1);
             var expires = "; expires=" + exdate.toGMTString();
             document.cookie = "logout=" + value + expires + "; path=/";

View Complete Post

More Related Resource Links

Web Form breaks after using the browser's back button

I have a web form that allows a user to put some data in a textbox and click a button to do a search on that data.  It opens up a Sql Server Reporting Services report using the data they entered on the previous page.  If they use the browser's back button to go back and enter some different criteria to search on, the buttons don't work anymore. Any ideas or suggestions on what would cause this?   Thanks! 

Back & forward button of browser hide...

Hiwithout script can i hide back & forward button of browser ..here lot of solution given but not working properly so please give me solutionthankscraj

Browser back button issue when ViewState stored in DB.

I implemented the solution of storing the ViewState in DB (since we were getting lots of Invalid & Corrupt Viewstate errors on our site daily) as given in the following website:http://weblogs.asp.net/adweigert/archive/2004/03/09/86628.aspxThe solution was implemented in one of the aspx pages on our site that behaves like a wizard (not using the wizard control though). After starting to store the viewstate in DB, the Invalid ViewState errors were eliminated completely, but I am now facing the following problem:1) User selects radiobutton1 of the two radiobutton choices on Page 2 of the wizard, a postback happens which displays some extra information on the page based on the selection. Now the user hits the next button on the page that also does a postback & displays Page 3.2) On Page 3, user hits the "back button" of the browser instead of the "previous page" button that is available on that page.3) This displays Page 2 from cache in original state(without any selections made). When user now selects radiobutton2, a postback is supposed to happen, but it does not. User then clicks "next" button on Page 2 (a postback does happen here however), & Page 3 is displayed, but it still thinks that radiobutton1 was selected (the original selection that was made in step1) on the previous page & hence displays information accordingly.I am assumi

Mobile redirect and the browser back button

Has anyone here ever successfully constructed a two-page mobile website with VB, one page for input and one page for displaying results?  If so, how do you call the results page and can you return to the input page using the back button on your mobile browser?  I have no problem creating such a website for regular browsers, but I simply cannot construct one for the iPhone or the Droid ... you can't return to the first page via the backbutton and still have it be functional; all you have is the graphics.  There is no load event for the page you're returning to.  It seems like mobile browsers don't handle server-side redirects properly.  If you open a new page via a hyperlink, you can return to the page you were on and it will still be functional; not so following a redirect to another page on your site. I've experimented endlessly with cache settings, redirect parameters, and the pagestatepersister class to no avail.  I need to know if I'm on a futile quest.  Can anyone offer confirmation for can do/can't do?    

Browser Back button

Hello,    Is there any way to know if the post back happen because of the broswer back button. Or I have a reapter control can i use response.redirect on a image to go to another page.Because i am using <a href now but problem is I want to know the previous page , for that i used URLRefferal but it is not getting the right page because it is a <a href not response.redirect.   Thank, 

logout problem(after logout when clicking on back button after logout still opens the previous page

I am using ASP.NET, the web page is abandoning and clear session when a user click logout link but they click the back button and it is still showing the previous page. How can it prevent the previous page after logout?on Logout.aspx load im using this code//=================//        Session.Clear();        Response.Buffer = true;        Response.ExpiresAbsolute = DateTime.Now.AddDays(-1D);        Response.Expires = -1500;        Response.CacheControl = "no-cache";        //----- Second Technique : To Stop Caching of Secure Pages.        Response.Cache.SetCacheability(HttpCacheability.NoCache);        FormsAuthentication.SignOut();        if (Session["UserName"] == null)        {            Response.Redirect("login.aspx");        }       Session.Clear();         Response.Buffer = true;         Response.ExpiresAbsolute = DateTime.Now.AddDays(-1D);         Response.Expires = -1500;         Response.CacheControl = "no-cac

how to disable back button of your browser

i want to know how can i restrict any user to access any webpage after logging out

ModalPopupExtender problem with browser back button


ModalPopUpExtender shows popup when user clicks browser back button.

I saw this thread but I could find the solution for this problem.


mesajrapor1 is my user control which contains the modalpopupextender

Here is my code:


protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
        HyperLink hyp = (HyperLink)e.Item.FindControl("hypGonderenAD");
        Label lblicer = (Label)e.Item.FindControl("lblIcerikMesaj");
        Label midlbl = (Label)e.Item.FindControl("lblIdMesaj");
        Label sidlbl = (Label)e.Item.FindControl("Label3");

        if (e.CommandName == "SikayetEt")
            mesajrapor1.RaporGonder(hyp.Text.ToString(), lblicer.Text.ToString(), Convert.ToInt32(midlbl.Text), Convert.ToInt32(sidlbl.Text));

Navigating Web Project with Browser's Back/Forward Button(s)


I am developing a web project in asp.net using vb and want to allow the user to navigate through my enrollment process using the Browser's Back and Forward buttons. Is this possible?


Thank you in advance.

disable back button of browser so that a user can't go on previous pages after signout


hi All

i am working in asp.net 2.0 with vb.net.

i want to disable back button of browser so that a user can't go on previous pages after pressing signout hyperlink.

i applied this code in load  event of page that i want to disable on back button of browser but it is not ing please help me in detail as soon as possible.





"Pragma", "no-cache")





Disable Back and Forward button in the IE and Mozilla browser


Hi every body

I want to disable back and forward button in the IE and Mozilla when my application (which is a WPF, XBAP project in the .Net 4.0) is deployed in a browser.

The main form is a System.Windows.Window. Please help me how can id do that.


Disable Browser Back Button Using Javascript ASP.NET


 Hi... Am using following script, disable back browser, it works well, only in Chrome, if i try ie it says .. Webpage has expired,   any simple method is there? but it should suitable for browsers !

<script type = "text/javascript" >
    function disableBackButton() {
    setTimeout("disableBackButton()", 0);

<body onunload="disableBackButton()">
Protected Overloads Overrides Sub OnPreRender(ByVal e As EventArgs)
        Dim strDisAbleBackButton As String
        strDisAbleBackButton = ""
        ClientScript.RegisterClientScriptBlock(Me.Page.[GetType](), "clientScript", strDisAbleBackButton)
End Sub

On browser back button click again login in Application problem



In my project I am using the FormsAuthenticationTicket and maintain session when any user login in the application. On logout I am expire the seesion using Session.Abandon (); but when I click on the browser back button after logout it again login in the application. I want after logout if any user clicks on the browser back button it do not again login in the application it redirect it on login page. But I do not how it could be possible.


Below is my code


protected void btnLogon_Click(object sender, EventArgs e)


            propertyStore.BusinessLayer.Users objUser = new propertyStore.BusinessLayer.Users();

            if (objUser.IsAuthentic(txtUserName.Text, txtPassword.Text))



                FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(


Infopath 2007 print view in browser enabled form with Print button


Hi i create a  print view brower enabled form in Infopath 2007 with header and footer. In Infopath works fine. Margin was ok, header and footter to. But then i try to print this browser the margin, header and footer it changes to default setting of browser ? I try also create a print button in form with VS 2008 code, but method :

this.print(); not working.

It is possible to print the "print view" in browser as the same like in Infopath 2007? Does anyone have the code how to create a print button in C# on browser enabled form?

Posting back a disabled button


Folks, I have a control which inherits from LinkButton and I'm trying to make sure that the user cannot cause mayhem by performing multiple postbacks.  That seemed an easy enough challenge, so I have this code [snippet] on the client:

ButtonClicked: function () {
    if (this._DisableOnClick == true) {
        this.get_element().disabled = 1;
        this.get_element().style.cursor = 'wait';
    else {
        alert('Posting back');

The alert is of course only there for debugging.  If the DisableOnClick value is false, then I see the "Posting Back" alert and, when I click ok, the postback occurs - all good.

If the DisableOnClick value is true, then the "button" gets disabled and the cursor turns into an hourglass - again good.  But the postback doesn't happen - not good.  I assume that the ASP client code is trying to help by preventing the postback when it sees that the link is disabled.

So, how can I either:

  • Persuade the LinkButton to postback even though it has just been disabled; or
  • [probably better] Get my client code to execute immediately after the postback code rather than before.



"Enable this Form to be filled out by using a browser" check box is grayed out when publishing InfoP

When I try to publish InfoPath form to a SharePoint site collection, "Enable this Form to be filled out by using a browser" check box is grayed. Also, I see the following warning message: This form template is br owser-compatible, but it cannot be browser-enabled on the selected site. This may be cased by one of the following reasons: -The server is not running InfoPath Forms Services. - The necessary features are not available on the site collection. The policy setting on the server does not allow user to browser -enabled Form templates. I have tried the following: 1. Deactivated and reactivated " office SharePoint Server Enterprise Site collection features" 2. Deactivated and reactivated " office SharePoint Server Enterprise Site features" 3. "Form Templates" document library exists and visible. 4. I am able to check the box in other site collections without any problems. 5. Ran the following stsadm commands: STSADM.EXE -o deactivatefeature -filename IPFSAdminLinks\feature.xml -url http://siteCollection -force STSADM.EXE -o deactivatefeature -filename IPFSSiteFeatures\feature.xml -url http://siteCollection -force STSADM.EXE -o deactivatefeature -filename IPFSWebFeatures\feature.xml -url http://siteCollection -force STSADM.EXE -o activatefeature -filename IPFSAdminLinks\feature.xml -url http://siteCollection -force STSADM.EX

Back Button for Parent Report

Hello all, I have created a summary report and have the hyperlink set up to jump to another detail report. In BIDS, when I get to the detail report, there is an option to go back to the parent report. But when I publish these reports to Report Manager, that back button is not there. Does anyone know a workaround to this? I really want the user to be able to go back to the summary report when they are done looking at the details. We are working on SSRS 2005. Any help would be greatly appreciated.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend