prevent refresh in asp

This is a discussion on "prevent refresh in asp" within the Classic ASP section. This forum, and the thread "prevent refresh in asp are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Oct 6th, 2005, 08:51
Junior Member
Join Date: May 2005
Location: bath - england
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
prevent refresh in asp

Hi I have a page which submits an email (amongst other things). If the user refreshes the page, the email is sent again.

Is there a bit of asp script which will block any attempts to refresh a page?

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Oct 8th, 2005, 15:09
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,669
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
I'm assuming your page is something like this:

<%
' process submitted info
' ............. commands, send email, etc

' if processed submitted info, show confirmation
' .......... confirmation
%>


<form action="<%=Request.ServerVariables("SCRIPT_NAME")% >" method=post>[/b]




if so, do what I do:
instead of displaying the confirmation just after the processing, redirect to the same page (without the form data) and then display confirmation.
that way, even if they user refreshes the page, no data has been submitted.

example:

<%
If Request.QueryString("action")="submit" Then
' process submitted info
' ............. commands, send email, etc
response.redirect "?action=confirm"
End If

If Request.QueryString("action")="confirm" Then
' if processed submitted info, show confirmation
' .......... confirmation
Response.End
End If
%>


<form action="?action=submit" method=post>
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Oct 10th, 2005, 09:04
Junior Member
Join Date: May 2005
Location: bath - england
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
aha!
good thinking. I'll give it a go.

Cheers.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
prevent, refresh, asp

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 On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Prevent multiple instances of web page duncanwill JavaScript Forum 2 May 21st, 2008 08:16
How to stop the browser refresh on clicking the webbrowser's refresh button ? camarun20 JavaScript Forum 3 Mar 18th, 2008 23:04
prevent line break after a checkbox pesho318i Web Page Design 7 Feb 6th, 2008 09:34
Prevent injection MSSql server ktsirig Databases 0 Oct 16th, 2007 08:58
Prevent special character in username marSoul PHP Forum 3 Sep 19th, 2007 13:55


All times are GMT. The time now is 14:23.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

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