RE: Email resent on page refresh




OK. So if I redirect then I do not get duplicate email send. However I do
not see the thank you message either. I tried the redirect after the
clientscript however that does not show the thank you message either. I
would like to show the thank you message and then redirect to a page. How
can I do that?

Response.Redirect("aboutSS-contacts.aspx");
ClientScript.RegisterStartupScript(GetType(), "OK!",
String.Format("alert('Thank you. Your request has been submitted to {0}');",
EmailTo.Replace("'", "\'")), true);


--
Thanks
Morris


"Allen Chen [MSFT]" wrote:

Hi Morris,

My page has several textbox fields and a submit button. I have attempted
to
reset the textbox fields to nulls after the email is sent. However, when
the
user clicks on the page refresh button, though the textbox fields are
empty,
another email gets sent (the email contains the fields previously entered
in
the fields.

How do I set the fields to null and not have the email resent on page
refresh?

From your description a user clicks refresh button on the browser and then
clicks the retry button on the popup window right? To avoid the code in the
button click event handler to be executed again in this case, the easiest
way is to add the following code at the bottom of the button click event
handler to redirect user to the same page. This will cause a get request
got sent when user clicking the refresh button, in which case the click
event handler will not be executed again.

Response.Redirect("YourPage.aspx"); //add it to the end of
SubmitContactForm_Button1_Click. Remember to replace YourPage.aspx with
your page name.

Please have a try and let me know if it can meet your requirement.

Regards,
Allen Chen
Microsoft Online Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.




.


Loading