KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to set the cache-control headers for a web application (and it appears that I'm able to do it), but I am getting what I think are odd entries in the header responses. My implementation is as follows: protected override void OnLoad(EventArgs e) { // Set Cacheability... DateTime dt = DateTime.Now.AddMinutes(30); Response.Cache.SetExpires(dt); Response.Cache.SetMaxAge(new TimeSpan(dt.ToFileTime())); // Complete OnLoad... base.OnLoad(e); } And this is what the header responses show: ----- GET /Pages/Login.aspx HTTP/1.1 Host: localhost:1974 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729) Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive X-lori-time-1: 1244048076221 Cache-Control: max-age=0 HTTP/1.x 200 OK Server: ASP.NET Development Server/8.0.0.0 Date: Wed, 03 Jun 2009 16:54:36 GMT X-AspNet-Version: 2.0.50727 Content-Encoding: gzip Cache-Control: private, max-age=31536000 Expires: Wed, 03 Jun 2009 17:24:36 GMT Content-Type: text/html; charset=utf-8 Content-Length: 6385 Connection: Close ----- Why does the "Cache-Control" property show up twice? Do I need both "Cache-Control" and the "Expires" properties? Is "Page_Load" the best place to put this code? Thanks!
Tags (comma-separated)
Save Edits
Cancel