Clearing Post Data

  • Thread starter Thread starter David P. Donahue
  • Start date Start date
D

David P. Donahue

I have an ASP .NET website where users submit comments and, depending on
whether or not the web service accepting the comments returns an error,
the form uses this.page.registerstartupscript() to popup a dialog box
confirming that the submission was received.

It seems that, after this takes place, the resulting page still has the
form data (even though the form elements have been cleared). Thus, a
refresh of the page re-submits the data. Is there a way to clear the
post data without using a Response.Redirect(), since that will render
the startupscript function useless?
 
What I usually do is perform a Redirect back to the page so that is acts
like this is the first time visiting the page.

For instance, you might do something like
Response.Redirect("MyPage.aspx?param1=..."). This would be called at some
point before the page renders. Maybe at the end of the Page_Load, or
someplace after your code.
 
Back
Top