Back Button and code execution

Discussion in 'ASP .Net' started by John, Jul 30, 2003.

  1. John

    John Guest

    Hi,

    I have a web form accounting app. In certain instances it
    causes trouble if the user clicks the Back button. I've
    read several posts that indicate that it is not
    recommended (or even possible) to try to disable the Back
    button. So, what I did was save a session variable with
    the name of the current webform and then check this
    session variable on page load to make sure the user was
    not coming from a page that was not acceptable.

    This works when I navigate to the page by typing in a URL
    but is seems like when I click the Back button to go to a
    page I should not go back to, the code behind is not
    executed. Is there some way to force this to always be
    executed?

    Thanks,
    John Ritchie
     
    John, Jul 30, 2003
    #1
    1. Advertising

  2. John

    Marina Guest

    The problem is that the browser loads a cached version of the page - so it
    doesn't go to the server at all.

    You can try to set the expiration of the page to expire immediately, but I'm
    not sure how well that works.

    "John" <> wrote in message
    news:0c9f01c356af$c86f51b0$...
    > Hi,
    >
    > I have a web form accounting app. In certain instances it
    > causes trouble if the user clicks the Back button. I've
    > read several posts that indicate that it is not
    > recommended (or even possible) to try to disable the Back
    > button. So, what I did was save a session variable with
    > the name of the current webform and then check this
    > session variable on page load to make sure the user was
    > not coming from a page that was not acceptable.
    >
    > This works when I navigate to the page by typing in a URL
    > but is seems like when I click the Back button to go to a
    > page I should not go back to, the code behind is not
    > executed. Is there some way to force this to always be
    > executed?
    >
    > Thanks,
    > John Ritchie
     
    Marina, Jul 30, 2003
    #2
    1. Advertising

  3. Hello John,

    Marina is right. Preventing it from caching may resolve this issue.

    Besides, In order to prohibit a page from caching, you could also place following Meta tag in the head of the html.
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">

    Hope that helps.

    Best regards,
    Yanhong Huang
    Microsoft Online Partner Support

    Get Secure! - www.microsoft.com/security
    This posting is provided "AS IS" with no warranties, and confers no rights.

    --------------------
    !Content-Class: urn:content-classes:message
    !From: "John" <>
    !Sender: "John" <>
    !Subject: Back Button and code execution
    !Date: Wed, 30 Jul 2003 08:32:27 -0700
    !Lines: 19
    !Message-ID: <0c9f01c356af$c86f51b0$>
    !MIME-Version: 1.0
    !Content-Type: text/plain;
    ! charset="iso-8859-1"
    !Content-Transfer-Encoding: 7bit
    !X-Newsreader: Microsoft CDO for Windows 2000
    !X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
    !Thread-Index: AcNWr8hsqj5nJmscRzCveBt3X2bLyg==
    !Newsgroups: microsoft.public.dotnet.framework.aspnet
    !Path: cpmsftngxa06.phx.gbl
    !Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:163398
    !NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
    !X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    !
    !Hi,
    !
    !I have a web form accounting app. In certain instances it
    !causes trouble if the user clicks the Back button. I've
    !read several posts that indicate that it is not
    !recommended (or even possible) to try to disable the Back
    !button. So, what I did was save a session variable with
    !the name of the current webform and then check this
    !session variable on page load to make sure the user was
    !not coming from a page that was not acceptable.
    !
    !This works when I navigate to the page by typing in a URL
    !but is seems like when I click the Back button to go to a
    !page I should not go back to, the code behind is not
    !executed. Is there some way to force this to always be
    !executed?
    !
    !Thanks,
    !John Ritchie
    !
     
    Yan-Hong Huang[MSFT], Aug 1, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sylvia sil
    Replies:
    1
    Views:
    652
    Curt_C [MVP]
    Dec 29, 2004
  2. Chicagoboy27

    image button as a back button

    Chicagoboy27, Oct 26, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    2,045
    Chicagoboy27
    Oct 30, 2006
  3. Author
    Replies:
    6
    Views:
    3,276
    George
    Jan 22, 2009
  4. peppeprof
    Replies:
    4
    Views:
    145
    peppeprof
    May 15, 2004
  5. Useful Info

    Firefox back button takes me back 2 pages.

    Useful Info, Jun 3, 2007, in forum: Javascript
    Replies:
    0
    Views:
    363
    Useful Info
    Jun 3, 2007
Loading...

Share This Page