Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Setting Cache-Control to Public in WebHandler does not work

Reply
Thread Tools

Setting Cache-Control to Public in WebHandler does not work

 
 
Sebastian Paul
Guest
Posts: n/a
 
      10-02-2007
Hi,

the task is easy: I want to have the Cache-Control set to Public.

void IHttpHandler.ProcessRequest(HttpContext context)
{
const int maxAge = 10;
_context.Response.Cache.SetExpires(DateTime.Now.Ad dSeconds(maxAge));
_context.Response.Cache.SetMaxAge(new TimeSpan(0, 0, maxAge));
_context.Response.Cache.SetCacheability(HttpCachea bility.Public);
_context.Response.Cache.SetLastModified(DateTime.N ow);
_context.Response.Cache.SetValidUntilExpires(true) ;
...
}

Things work fine, output is actually cached by ASP.NET, the HTTP
header value of max-age counts down to zero until content expires.
Only the Cache-Control keeps being private. Why?? I explicitly set the
value to HttpCacheability.Public...

Thanks for any help.
Sebastian

 
Reply With Quote
 
 
 
 
Sebastian Paul
Guest
Posts: n/a
 
      10-10-2007
Now I noticed that the same applies to ASPX Pages. Fortunately, I had
a look on our production envirionment (IIS) - Cache-Control is
actually Public there!
It turns out that the ASP.NET Development Server (aka Cassini) always
sets to Private (as well as it only allows private connections). That
makes sense and is good, but one has to know it...

Kind regards, Sebastian

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
microsoft.public.certification, microsoft.public.cert.exam.mcsa, microsoft.public.cert.exam.mcad, microsoft.public.cert.exam.mcse, microsoft.public.cert.exam.mcsd loyola MCSE 4 11-15-2006 02:40 AM
microsoft.public.certification, microsoft.public.cert.exam.mcsa, microsoft.public.cert.exam.mcad, microsoft.public.cert.exam.mcse, microsoft.public.cert.exam.mcsd loyola Microsoft Certification 3 11-14-2006 05:18 PM
microsoft.public.certification, microsoft.public.cert.exam.mcsa, microsoft.public.cert.exam.mcad, microsoft.public.cert.exam.mcse, microsoft.public.cert.exam.mcsd loyola MCSD 3 11-14-2006 05:18 PM
microsoft.public.certification, microsoft.public.cert.exam.mcsa, microsoft.public.cert.exam.mcad, microsoft.public.cert.exam.mcse, microsoft.public.cert.exam.mcsd realexxams@yahoo.com Microsoft Certification 0 05-10-2006 02:35 PM
microsoft.public.dotnet.faqs,microsoft.public.dotnet.framework,microsoft.public.dotnet.framework.windowsforms,microsoft.public.dotnet.general,microsoft.public.dotnet.languages.vb Charles A. Lackman ASP .Net 1 12-08-2004 07:08 PM



Advertisments