Back Button and code execution

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default 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
    John Guest

  2. Similar Questions and Discussions

    1. Pausing Code Execution
      I want to create an Alert/Message box in Flash MX. I want to be able to do something like this: var retval = message("Save File Before...
    2. Execution code run backward
      Hi, I've never seen similar problem before. Application_AuthenticateRequest in Global.asax.vb file execute 4 time before it exit to the default.vb...
    3. Can't execute code from a freed script on BACK button
      I've got a series of ASP pages that display data. The pages pass variables forward via QueryString. Strange thing I'm finding is that if I get a few...
    4. execution of script from button
      Hi all: I am a newbie in terms of PERL. Here's what i want to do. I ahve a HTML page that has a button on it. I want a user to click on that...
    5. PERL code execution rule?
      I was under the impression that "subroutines" are only executed IF they're called. But, it looks like subroutines will execute on there own if they...
  3. #2

    Default 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@dashgroup.com> wrote in message
    news:0c9f01c356af$c86f51b0$a601280a@phx.gbl...
    > 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 Guest

  4. #3

    Default 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! - [url]www.microsoft.com/security[/url]
    This posting is provided "AS IS" with no warranties, and confers no rights.

    --------------------
    !Content-Class: urn:content-classes:message
    !From: "John" <jcronline@dashgroup.com>
    !Sender: "John" <jcronline@dashgroup.com>
    !Subject: Back Button and code execution
    !Date: Wed, 30 Jul 2003 08:32:27 -0700
    !Lines: 19
    !Message-ID: <0c9f01c356af$c86f51b0$a601280a@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: 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] Guest

  5. #4

    Default Back Button and code execution

    Hi,
    I have the same problème and the "meta" do not seems work.
    If i refresh or i try in an other tab, it work. But with the back button i got a cache.

    Thanks.
    Maxime Guest

  6. #5

    Default Back Button and code execution

    Re,

    http://stackoverflow.com/questions/49547/making-sure-a-web-page-is-not-cached-across-all-browsers

    Here I found this solution with php :

    header('Cache-Control: no-cache, no-store, must-revalidate');
    header('Pragma: no-cache');
    header('Expires: 0');

    the same in plain html work only with IE:

    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Expires" content="0">
    Maxime Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139