Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to stop asp page to reload again by clicking refresh 1

Status
Not open for further replies.

monaamit

Technical User
Feb 11, 2005
14
US
I have two asp pages. One collects data, and second one sends thankyou email. The secong page sends email as many times as users refreshes the page. How can I stop reloading the page. Please help.
 
This might not be the "best" way but an idea nonetheless...

Wrap the block of code that does the email sending with an if statement similar to:
Code:
if session("emailsent") is nothing or session("emailsent") = "no" then
   ' your email code
end if

And after you send the mail, set session("emailsent") = "yes"

This might need tweaked to check for other possibilities of session("emailsent") -- I can't remember if you should check for isnull or empty quotes or what. Also, you'll need a point in your code (somewhere else most likely) where you clear out that flag and let another email be sent.
 
Why don't you make the page that sends the email a separate page, then redirect to the destination page? That would avoid any problems with refreshing.

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top