开发者

Prevent browser from re-sending form information that has allready submitted to server

How can I prevent user to resend data by refreshing the URL ?

(Actually after posting data to the server and returning back data by the server to the cl开发者_开发知识库ient: if user refreshes the url address then again he sends back to the server with previous data)

So, how can I prevent it by c#, asp.net ?


supposedly, if it is POST, the browser should ask the user whether to send the data again, so just refreshing the same URL alone won't cause that to happen.

If you want to prevent the user from saying "Yes" and have the same data posted to the server again, you can use a timestamp and/or a random number to prevent the same data posted to the server. If the same timestamp and/or random number is already in the DB for that user, then handle it as a duplicate -- or ask the user whether to do the same action again.


Sorry I could not get you question at first.

Track if the same form in being published with same IP in a specified duration with the same values at server end.


You can do a Response.Redirect to a new page letting the user know their information has submitted successfully. Then if they do a refresh on that page it won't resubmit any of their data.

Look at the following article for more information. http://en.wikipedia.org/wiki/Post/Redirect/Get

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜