开发者

Page expiration after postback in ASP.NET

开发者 https://www.devze.com 2022-12-22 12:10 出处:网络
I\'ve been doing web development for a while and have yet to read a good answer to this question: Given a page that executes transactions through a postback, how do you prevent the user from duplicat

I've been doing web development for a while and have yet to read a good answer to this question:

Given a page that executes transactions through a postback, how do you prevent the user from duplicating the transaction when they do something as simple as hit the back button? I've explored trying expir开发者_如何学JAVAe the cache but I must admit I'm lacking in my understanding of ASP.NET caching. What is the approach I should use to make the old request stale and invalid? Thanks!


It's called Post/Redirect/Get.

In ASP.Net, you don't have to do this religiously because many of your postbacks don't actually create transactions. But whenever you do create a transaction of some kind, make sure you redirect to a new page.


Check out Response.Expires

http://msdn.microsoft.com/en-us/library/ms525906.aspx

0

精彩评论

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

关注公众号