Refresh the page after a postback action in asp.net

MOZILLA picture MOZILLA · Feb 16, 2009 · Viewed 58k times · Source

I have command button added in my asp.net grids. After performing an action using that button, we refresh the grid to reflect the new data. (basically this action duplicates the grid row).

Now when user refresh the page using F5, an alert message is displayed (to resend the information to server) if we select "retry", the action is repeated automatically.

I know this is a common problem in asp.net, how can we best handle this?

Answer

chris picture chris · Feb 16, 2009

Search for GET after POST - http://en.wikipedia.org/wiki/Post/Redirect/Get - basically, redirect to the current page after you're finished processing your event.

Something like:

Response.Redirect(Request.RawUrl)