Page Expiration

Discussion in 'ASP.NET / ASP.NET Core' started by davidseye, May 7, 2003.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. 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.
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    Insert a no-cache meta tag to your header

    <meta http-equiv="pragma" content="no-cache"></meta>


    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">
     
  3. 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.
     
  4. Bruce

    Bruce DiscountASP.NET Staff

    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"



    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">
     
  5. 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.
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page