473,626 Members | 3,947 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to prevent to go to the previous page?

Hi,

the user gets a form to fill. All the filled values are put into session
variables.
I want to prevent that he could click to the previous arrow of the browser
and then comes back to the form. Is that possible with asp.net?

Or, is it possible to clear the session when leaving the form page by
clicking the previous arrow?

Thanks
Eric
Nov 9 '08 #1
5 3651
On Nov 9, 11:26*am, "Eric" <e...@sdsclem.p owrote:
Hi,

the user gets a form to fill. All the filled values are put into session
variables.
I want to prevent that he could click to the previous arrow of the browser
and then comes back to the form. Is that possible with asp.net?

Or, is it possible to clear the session when leaving the form page by
clicking the previous arrow?

Thanks
Eric
Hi Eric

this could do the trick

<script language="JavaS cript">
if(history.leng th>0)
history.go(+1);
</script>

If user disabled javascript that wouldn't work and you would need to
look for another approach.

Hope this helps
Nov 9 '08 #2
Thanks a lot.
If you don't mind, could you tell me more (or refer) about the another
approach?
This is a good solution, but if possible, i would prefer a more waterproof
way.
Thanks

"Alexey Smirnov" <al************ @gmail.comschre ef in bericht
news:66******** *************** ***********@35g 2000pry.googleg roups.com...
On Nov 9, 11:26 am, "Eric" <e...@sdsclem.p owrote:
Hi,

the user gets a form to fill. All the filled values are put into session
variables.
I want to prevent that he could click to the previous arrow of the browser
and then comes back to the form. Is that possible with asp.net?

Or, is it possible to clear the session when leaving the form page by
clicking the previous arrow?

Thanks
Eric
Hi Eric

this could do the trick

<script language="JavaS cript">
if(history.leng th>0)
history.go(+1);
</script>

If user disabled javascript that wouldn't work and you would need to
look for another approach.

Hope this helps
Nov 9 '08 #3
On Sun, 09 Nov 2008 13:30:46 +0100, Eric <er*@sdsclem.po wrote:
This is a good solution, but if possible, i would prefer a more
waterproof way.
Make sure that the input form does not get cached client-side:

Response.Cache. SetCacheability (HttpCacheabili ty.NoCache)

Reject/redirect the user from the input form if the session variable is
already set:

if (Request.Sessio n["foo"] != null) Response.Redire ct("bar.aspx")

--
Joern Schou-Rode
http://malamute.dk/
Nov 9 '08 #4
"Eric" <er*@sdsclem.po wrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
>>the user gets a form to fill. All the filled values are put into session
variables.
I want to prevent that he could click to the previous arrow of the
browser
and then comes back to the form. Is that possible with asp.net?

Or, is it possible to clear the session when leaving the form page by
clicking the previous arrow?

<script language="JavaS cript">
if(history.len gth>0)
history.go(+1) ;
</script>

If user disabled javascript that wouldn't work and you would need to
look for another approach.

If you don't mind, could you tell me more (or refer) about the another
approach?
This is a good solution, but if possible, i would prefer a more waterproof
way.
This is a very common question - there are hundreds of articles about it on
the web:
http://www.google.co.uk/search?sourc...button+disable

There really is no 100% guaranteed method for this which will work in all
cases on all browsers on all platforms. Principally, this is because the
navigation buttons are part of the browser, not the web application...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 9 '08 #5
On Nov 9, 1:30*pm, "Eric" <e...@sdsclem.p owrote:
Thanks a lot.
If you don't mind, could you tell me more (or refer) about the another
approach?
This is a good solution, but if possible, i would prefer a more waterproof
way.
Thanks
Another appoach is what Joern told you. You used a session for storing
the values, so you can check if session already has the values or not.
If session has stored values you would redirect to the next page.
There is another limit - session will not work if user has cookies
disabled. So, theoretically speaking, this is not a 100% solution. In
the same time you use session to store values and if session will not
work your form will not work as well. And if cookies are required to
use your site (it seems) then this maybe the best way to prevent
people from going back
Nov 9 '08 #6

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

Similar topics

3
3047
by: Marcel | last post by:
Hello, I'm working on a search application for my website. The website contains a lot of pictures, and a search should return clickable thumbnails. No problems there. My problem started when I wanted to build in NEXT and PREVIOUS buttons, so that you only get 5 or 10 or 20 (I haven't made up my mind yet) thumbnails at a time. I use a SQL LIMIT statement to achieve that. After displaying the first 5 pictures I would like to see the next 5,...
5
2314
by: Daniel | last post by:
Does anyone know how this can be done? Thanks
3
9997
by: Rob | last post by:
Each time a webform is posted back (submitted), another URL is added to the browser's history list. My web application allows a back button to return to previously visited pages, but I do not wish to return to each Postback URL, but rather only the initial page URL. Is there a way to prevent Postback URL's from being added to the browser's history list Thanks in advance for any help.
2
1393
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 show the login page as to request the user to log in again and gain the private access. Your help will be appreciated and thanx in advance Khor.
18
3384
by: Gleep | last post by:
I've searched google intensely on this topic and it seems noone really knows how to approch this. The goal I don't want clients to give out their usernames and passwords to friends, since the site relies on subscrption fees. Sessions ID's are matched between the browser and the server. So a users can login with same username and password and those sessions are tracked individually. Some suggest create table fields with the session ID...
2
20627
by: Rob Roberts | last post by:
Is there any way to prevent a ButtonField in a GridView from doing a postback when clicked? I want to use my own onclick handler to call window.open('SomePage.aspx') to display a page in a new browser window when the button is clicked. I tried doing this in the RowCommand postback event by doing this in the event handler: Response.Write("<script>window.open('SomePage.aspx');</script>");
5
12226
by: Andy | last post by:
Hi, I want to prevent the user from viewing the previous page using the Back button after logout. I want to instead show that this page has expired. How do I do this? Here is my codebehind on the logoff page. private void Page_Load(object sender, System.EventArgs e) {
3
3252
by: Ben | last post by:
Hello I am in the final stages of developing my asp.net app and have a question. The app im creating has two frames, one being a menu and the other showing the detail. I would like to prevent the user for typing in direct addresses without using the application (ie server/appname/page.aspx?parameter=value). Is it possible to prevent a user from attemping this? Can it be detected and then rerouted to the default page (ie...
5
3222
by: Bill Davidson | last post by:
All: Pardon the newbie question, but let's say I've got two pages in my website: Welcome.aspx NoNav.aspx I want users to be able to navigate to the welcome.aspx page (e.g. http://myserver.com/Welcome.aspx), but I don't want them to be able to navigate directly to NoNav.aspx. The NoNav.aspx page will be loaded only by
0
8266
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8199
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8638
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8365
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6125
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2626
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1811
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1511
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.