How can I avoid cache?

S

Shawn

Hi.

We have a web application that is used by several different companies. Each
company have access to a couple of hundred records which they are updating
daily. One of they companies have reported many problems since their IT
department set up a proxy server. When they click a button to save data or
insert a new record all they get is a "Page cannot be displayed"-page. If
they press back in IE and try again, they might or might not be able to
perform the desired action. In general they get the "Page cannot be
displayed" 3 or 4 times when pressing back and trying again.



I'm pretty sure that this has to do with the proxy caching web pages. Is
there something I can do so that this company's proxy server won't cache my
web pages?



Thanks,

Shawn
 
J

Juan T. Llibre

Have you tried using :

Cache.SetNoStore();
and
Cache.SetCacheability(HttpCacheability.NoCache);

?



Juan T. Llibre
ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
==========================
 
S

Shawn

I haven't tried anything yet. I've never worked with caching before. Where
would I put this code?



Shawn
 
J

Juan T. Llibre

You can put it in the Page_Load event.

VB.NET :
Sub Page_Load(sender As Object, e As EventArgs)
Response.Cache.SetNoStore()
Response.Cache.SetCacheability(HttpCacheability.NoCache)
End Sub

C#
private void Page_Load(object sender, EventArgs e) {
Response.Cache.SetNoStore();
Response.Cache.SetCacheability(HttpCacheability.NoCache);
}




Juan T. Llibre
ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
==========================
 

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,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top