View Full Version : Page Expiration
davidseye
05-07-2003, 08:31 AM
Can anyone give me some pointers?
In an aspx page, I want to make it so a user cannot access a certain page where some data has been entered in a form a second time by using the browser's back button so duplicate submissions are not accidentally written to the db. I have it so that when a new instance of the form in invoked in the page all the fields are cleared of their view state information, but I can't seem to control it when it is recalled from the back button.
Can anyone give me some guidance with this, please.
bruce
05-08-2003, 07:28 AM
Insert a no-cache meta tag to your header
<meta http-equiv="pragma" content="no-cache"></meta>
[b]quote:Originally posted by davidseye
Can anyone give me some pointers?
In an aspx page, I want to make it so a user cannot access a certain page where some data has been entered in a form a second time by using the browser's back button so duplicate submissions are not accidentally written to the db. I have it so that when a new instance of the form in invoked in the page all the fields are cleared of their view state information, but I can't seem to control it when it is recalled from the back button.
Can anyone give me some guidance with this, please.
</blockquote id="quote"></font id="quote">
davidseye
05-08-2003, 09:23 AM
Yeah, that's what I thought too. But it didn't work. I didn't have a closing meta tag so I thought that would make a difference, but it didn't. It just doesn't seem to do the trick. I thought .NET might hav some special way. Oh well. I have bigger fish to fry today. I will worry about it tomorrow. Thanks, Bruce, for responding.
bruce
05-08-2003, 09:32 AM
Try put this in your page_load sub
Response.Expires = 60
Response.ExpiresAbsolute = CDate("07/29/1977")
Response.AddHeader("pragma", "no-cache")
Response.AddHeader("cache-control", "private")
Response.CacheControl = "no-cache"
[b]quote:Originally posted by davidseye
Yeah, that's what I thought too. But it didn't work. I didn't have a closing meta tag so I thought that would make a difference, but it didn't. It just doesn't seem to do the trick. I thought .NET might hav some special way. Oh well. I have bigger fish to fry today. I will worry about it tomorrow. Thanks, Bruce, for responding.
</blockquote id="quote"></font id="quote">
davidseye
05-17-2003, 08:12 AM
I finally got back to that page I was trying to expire. I put the code you suggested. It worked like a charm. Thanks for your help.
vBulletin® ©Jelsoft Enterprises Ltd.