ASPX page not always being "called"

  • Thread starter Thread starter epigram
  • Start date Start date
E

epigram

This is probably a more general HTML question, but here it goes. We're
creating an asp.net app and noticed that sometimes if an aspx page has
already been visited (say, in a given session) that the page doesn't
actually get requested from the web server. In other words, we have
breakpoints on the page's constructor, init, pageload, etc. and they don't
get hit when this happens.

I turned off caching in IE ( by changing the Temporary Internet files
Settings via Tools | Internet Options) to see if it was the browser's fault,
and it appears it is. When I turned off caching the aspx page gets executed
on the server every time. So, I want to know how do you deal with this?
Can this be solved with a META tag or similar convention? There are certain
aspx pages we ALWAYS want to be requested so we can execute logic on the
server. So if the browsers, or IIS for that matter, caches the page we'll
be in trouble.

Any help would be much appreciated!

Thanks.
 
Hello,

Are you sure that you are not using "Page.IsPostBack" in the Page_Load?

This seems to work for me with not having pages cache:
Response.CacheControl = "No-cache"

I hope that this is helpful to you,
Charles
 
Charles said:
Hello,

Are you sure that you are not using "Page.IsPostBack" in the
Page_Load?

This seems to work for me with not having pages cache:
Response.CacheControl = "No-cache"

That's a rather awful way to do it in ASP.NET. Use the HttpCachePolicy
class instead.

Response.Cache.SetCacheability(HttpCacheability.NoCache);

Cheers,
 
Back
Top