473,469 Members | 1,612 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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
Nov 17 '05 #1
2 4238
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" <jc*******@dashgroup.com> wrote in message
news:0c****************************@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

Nov 17 '05 #2
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" <jc*******@dashgroup.com>
!Sender: "John" <jc*******@dashgroup.com>
!Subject: Back Button and code execution
!Date: Wed, 30 Jul 2003 08:32:27 -0700
!Lines: 19
!Message-ID: <0c****************************@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
!
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: FluxForums | last post by:
<a href="" onclick="history.go(-1); return false;">Your Image or Tex Link</a -- FluxForum ----------------------------------------------------------------------- FluxForums's Profile:...
0
by: Ken Larose | last post by:
Hi, When I was programing in VB6, I found the following debugging feature very useful. While running my code and viewing a form, I would switch back to the VB6 an pause the execution. Then I...
4
by: peppeprof | last post by:
Hi- I need to use self.scrollTo(x,y) as the last action in a js function called by a onClick event. It seems that the scrolling actually takes place, but the document is then scrolling back to...
6
by: Paul Perot | last post by:
Hi All: I was wondering if it was possible to evoke a post back event during code execution. I have a form that contains file specific information. I would like to iterate through an array of...
2
by: Khor | last post by:
Does anyone know to . Prevent current user to access page previous page by pressing back button after the user had logging off his/her account If the user press the back button, the web should...
8
by: Galina | last post by:
Hello I have 6 dependent list boxes on my ASP page:  Faculty;  Lecturer;  Course;  Course occurrence;  Group;  Week commencing date. When faculty is selected, lists of lecturers and...
6
by: Mark | last post by:
I have two dropdown lists. Both have autopostback set to true. In both dropdowns, when you select an item from the list, it redirects to the Value property of the dropdown. Nothing fancy. ...
29
by: Tom wilson | last post by:
I can't believe this is such an impossibility... I have an asp.net page. It accepts data through on form fields and includes a submit button. The page loads up and you fill out some stuff. ...
15
by: Oleg Subachev | last post by:
I need to programmatically invoke from other class Click event of the Button on my Form. Button.OnClick method is protected, not public. How to perform this ? Oleg Subachev
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.