473,324 Members | 2,124 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

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 3640
On Nov 9, 11:26*am, "Eric" <e...@sdsclem.powrote:
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="JavaScript">
if(history.length>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.comschreef in bericht
news:66**********************************@35g2000p ry.googlegroups.com...
On Nov 9, 11:26 am, "Eric" <e...@sdsclem.powrote:
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="JavaScript">
if(history.length>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.powrote:
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(HttpCacheability.No Cache)

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

if (Request.Session["foo"] != null) Response.Redirect("bar.aspx")

--
Joern Schou-Rode
http://malamute.dk/
Nov 9 '08 #4
"Eric" <er*@sdsclem.powrote in message
news:%2****************@TK2MSFTNGP02.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="JavaScript">
if(history.length>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.powrote:
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
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...
5
by: Daniel | last post by:
Does anyone know how this can be done? Thanks
3
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...
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...
18
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...
2
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...
5
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...
3
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...
5
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....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.