Prevent Browser Caching for a Page

R

R. Ian Lee

I have an ASP.NET page that spawns a popup window using
javascript's window.open. This works fine. It pops up,
you enter some data, press save and everything saves as
it should. But, if you click the button to open the
popup again, then it opens with the values that were in
it before the "save" was executed. I've determined that
the problem is that IE is storing the page in it's local
temporary internet files cache and isn't going to the
server to retrieve a fresh version. Is there something
that I can put in the html header to force IE to always
expire the page immediately?

Thanks!

Ian
 
J

Jacob Yang [MSFT]

Hi Ian,

Based on my research and experience, There are two ways to instruct browser
not to use the copy in cache.

1. Add a meta data inside the <head> section. Please check the following
article for the details.

Prevent the browser from Caching a page
http://www.pacificnet.net/~johnr/meta.html
"...
This page is an explanation of using the Meta tag to prevent caching, by
browser or proxy, of an individual page wherein the page in question has
data that may be of a sensitive nature as in a "form page for submittal"
and the creator of the page wants to make sure that the page does not get
submitted twice.
..."

2. From server side, we can render the meta data via the Response object.
For example,

Response.Expires = -1

Please check the HttpResponse class for the detailed info

Does it answer your question? If I have misunderstood your concern, please
feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
K

Kevin Spencer

Hi Jacob,

I have a suggestion. For the next version of ASP.Net, include a property of
the Page class which can turn on or off Browser caching (by adding the
appropriate headers), and make it non-cached by default. I know of very few
situations in which ASP.Net pages SHOULD be cached by the browser.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.
 
J

Jacob Yang [MSFT]

Hi Kevin,

Thank you for your suggestion.

Please feel free to visit the following URL for sending feedback to
Microsoft Products.

http://register.microsoft.com/mswish/suggestion.asp?&SD=GN&LN=EN-US&gssnb=1
"By offering suggestions through this page, you give Microsoft full
permission to use them freely. We can't guarantee we will use your
suggestions, but we will review them for use in future products..."

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top