Re: ASP.NET Postback Refresh Problem

M

Munsifali Rashid

If you want to stop this happening, what you could do is a response.redirect
back to the same page, after your server side event has finished running.
This would reload the page afresh, and when the user hits refresh, it
wouldn't prompt them to re-post the form data.

E.g.

Protected Sub Button1_Click Handles Button1.Click

'Your custom code here
Dim foo As String = "foo"

'Redirect back to this page when done
Response.Redirect(Request.Path)

End Sub

Although it would solve the problem, it would be an additional server round
trip, though I'm not sure it can be avoided...

You could try using Server.Transfer(Request.Path, False), but I don't think
this would work as the page redirect would happen in the background, and
when the user refreshes, it would still prompt them to re-post the form
data.

Hope this helps,

Mun
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top