How to prevent aspx page from being cached by user's browser?

F

feng

In my ASP.Net app I have a aspx page that's called by an
other page's client side JavaScript code. The problem is
that the first time this page get loaded, it will be
cached in the user's local cache and will not be refreshed
in the following calls. I checked the following calls and
I see that even the page's Page_Load method of the
codebehind will not be invoked.

I also checked that if I clear the browser's cache each
time the page get called, then the following call will be
refreshed.

My question:
1) I have many aspx pages, why only this page has this
issue:
2) What do I do to solve this problem?

Here is the client side JavaScript that calls the this
page, and the 'Open/QicWebError.aspx' is the aspx page I
am talking about:

<script language='javascript'>
window.showModalDialog
('Open/QicWebError.aspx', '_blank', 'height=380,
width=490', true);
</script>
 
E

Eric Lawrence [MSFT]

If you don't specify HTTP expiration using Cache-Control headers or Expires
headers, IE is free to "guess" your intentions.

You can explicitly force your response not to get cached:

See the

Response.Cache.SetExpires
Response.Cache.SetMaxAge
and
Response.Cache.SetRevalidation

members for more info.

--
Thanks,

Eric Lawrence
Program Manager
Assistance and Worldwide Services

This posting is provided "AS IS" with no warranties, and confers no rights.
 
T

Teemu Keiski

Hi,

you can also try putting

<%@ Outputcache Location="None"%>

directive at top of your page's aspx (just after Page directive)

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist

In my ASP.Net app I have a aspx page that's called by an
other page's client side JavaScript code. The problem is
that the first time this page get loaded, it will be
cached in the user's local cache and will not be refreshed
in the following calls. I checked the following calls and
I see that even the page's Page_Load method of the
codebehind will not be invoked.

I also checked that if I clear the browser's cache each
time the page get called, then the following call will be
refreshed.

My question:
1) I have many aspx pages, why only this page has this
issue:
2) What do I do to solve this problem?

Here is the client side JavaScript that calls the this
page, and the 'Open/QicWebError.aspx' is the aspx page I
am talking about:

<script language='javascript'>
window.showModalDialog
('Open/QicWebError.aspx', '_blank', 'height=380,
width=490', true);
</script>
 

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,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top