Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > how to prevent to go to the previous page?

Reply
Thread Tools

how to prevent to go to the previous page?

 
 
Eric
Guest
Posts: n/a
 
      11-09-2008
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


 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      11-09-2008
On Nov 9, 11:26*am, "Eric" <(E-Mail Removed)> wrote:
> 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
 
Reply With Quote
 
 
 
 
Eric
Guest
Posts: n/a
 
      11-09-2008
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" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed)...
On Nov 9, 11:26 am, "Eric" <(E-Mail Removed)> wrote:
> 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


 
Reply With Quote
 
Joern Schou-Rode
Guest
Posts: n/a
 
      11-09-2008
On Sun, 09 Nov 2008 13:30:46 +0100, Eric <(E-Mail Removed)> 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(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/
 
Reply With Quote
 
Alexey Smirnov
Guest
Posts: n/a
 
      11-09-2008
On Nov 9, 1:30*pm, "Eric" <(E-Mail Removed)> wrote:
> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
prevent dropdown with previous input groups2@reenie.org Javascript 3 06-20-2007 08:22 PM
Opening with tabs from previous session Andy J. Firefox 1 05-31-2005 03:05 AM
Continue previous session in Firefox? Cueball Firefox 7 03-25-2005 02:48 AM
Re-visiting the previous page Sam D. Firefox 1 09-28-2004 01:45 PM



Advertisments