Back Button and code execution

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John

    #1

    Back Button and code execution

    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

    #2
    Re: Back Button and code execution

    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" <jcronline@dash group.com> wrote in message
    news:0c9f01c356 af$c86f51b0$a60 1280a@phx.gbl.. .[color=blue]
    > 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[/color]


    Comment

    • Yan-Hong Huang[MSFT]

      #3
      RE: Back Button and code execution

      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" <jcronline@dash group.com>
      !Sender: "John" <jcronline@dash group.com>
      !Subject: Back Button and code execution
      !Date: Wed, 30 Jul 2003 08:32:27 -0700
      !Lines: 19
      !Message-ID: <0c9f01c356af$c 86f51b0$a601280 a@phx.gbl>
      !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: AcNWr8hsqj5nJms cRzCveBt3X2bLyg ==
      !Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
      !Path: cpmsftngxa06.ph x.gbl
      !Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1633 98
      !NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
      !X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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
      !


      Comment

      Working...