I am trying to neatly disable output caching for WCF application. enableOutputCache attribute does not work for some reason, can someone explain the reason, or suggest a work around.
<system.web>
<caching>
<outputCache enableOutputCache="false" enableFragmentCache="false"></outputCache>
<outputCacheSettings>
<outputCacheProfiles>
</outputCacheProfiles>
</outputCacheSettings>
</caching>
</system.web>
Thanks
I know this is an old question but I'd like to give my two cents. I actually needed to disable caching of webapi services that are called by a SPA, and on some versions of IE they where cached by default unless the cache-control:no-cache and similar headers where present. What I did to enable browser caching of static resources and disable it for all the services was add the headers depending on the location using the web-config.
i.e.
<location path="api">
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Cache-Control" value="no-cache" />
<add name="Expires" value="-1" />
<add name="Pragma" value="no-cache" />
</customHeaders>
</httpProtocol>
</system.webServer>
Related
I am asking this question here because every other trick in the book from various sites including microsofts has failed to fix this for me.
I have added
<security>
<requestFiltering removeServerHeader="true" />
</security>
in <system.webserver>
Then i also added
<system.web>
<httpRuntime enableVersionHeader="false"/>
</system.web>
also added
<httpProtocol>
<customHeaders>
<clear />
</customHeaders>
</httpProtocol>
However none of this seems to remove the "Server" header from the response.
Any idea as to what else i can try other than URlRewrite or outboundrule??
I have this site but the css files do not seem to load correctly :http://185.58.193.198:12500/HelpDesk/
Can some tell me what changes i should make. I have used wamp for the database and IIS for hosting
There many reasons for 403 error, you can try to add below code in your web.config file:
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Methods" value="GET,PUT,POST,DELETE,OPTIONS" />
<add name="Access-Control-Allow-Headers" value="Content-Type" />
</customHeaders>
</httpProtocol>
</system.webServer>
and you can also try enabled anonymous authentication in iis authentication.
I am trying to implement the advice from Google's Pagespeed concerning browser caching(Set Expirer or Cache-control headers on static content).
After reading many posts here (like IIS7 Cache-Control ) and on other website I just can't seem to figure out why Pagespeed is for example still disapproving my CSS files.
For example: http://test.grotefeesten.nl/clientdata/71/js/jssor.config.js. This file has an expiration time of 1 day according to local PageSpeed but not according to the online PageSpeed test.
My web.config:
<caching>
<profiles>
<add extension=".css" policy="CacheUntilChange"
kernelCachePolicy="CacheUntilChange" location="Any" />
</profiles>
</caching>
<httpProtocol>
<customHeaders>
<add name="Cache-Control" value="public" />
</customHeaders>
</httpProtocol>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlCustom="max-age"
cacheControlMaxAge="1.00:00:00" />
</staticContent>
Does anybody see what I am missing here to set the Expires header properly?
I had been struggling with this myself. However, I found a solution:
<httpProtocol>
<customHeaders>
<add name="Cache-Control" value="max-age=2592000" />
</customHeaders>
</httpProtocol>
This was all it took. The value in the code above, "max-age=2592000", is 1 month.
I have this in my web.config:
<system.webServer>
<httpProtocol>
<customHeaders>
<clear />
<add name="Cache-Control" value="max-age=30,public" />
</customHeaders>
</httpProtocol>
</system.webServer>
But when I load the page, this is the response header:
Cache-Control: private,max-age=30,public
It is an ASP.NET MVC application, the controller has no cache directives specified anywhere.
try this
<system.web>
<httpRuntime sendCacheControlHeader="false" />
</system.web>
Let us know how it goes.
Jason
Environment: IIS 7, .Net 4.0
In web.config of our application, it has this section:
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="cache-control" value="no-cache" />
</customHeaders>
</httpProtocol>
</system.webServer>
Most of our application requires no-cache, but there is only one page that requires cache-control to be Private. Is a way to do it?
Appreciated for any input
You cannot apply or override settings from web.config to a particular page, however you can do this for all pages inside a folder, by following settings.
<system.webServer>
<httpProtocol>
<customHeaders>
<remove name="cache-control" />
<add name="cache-control" value="no-cache" />
</customHeaders>
</httpProtocol>
</system.webServer>
However, you can override the cache-control settings in Page_Load event of a particular page.
Response.CacheControl = "Private";
You can also change response caching for a page by setting the location attribute of #outputcache directive.
<%# OutputCache Location="Server" %>