Hi All, may I ask your help for no cache settings? we would like to avoid code change but not sure the technical approach.
Background
We are hosting the internet facing ASP.net application.
the security report just said the following HTTP headers need to be set through either the application framework or within the web server configuration:
Cache-Control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0 Expires: 0 Pragma: no-cache
However, our code already used "System .Web.Caching" class for caching for some useful objects.
Questions
Q1) How can I use web server configuration (e.g. web.config) for above settings?
Q2) If Q1 is not applicable, how can I update it by global ASAX File?
Q3) If Q1/Q2 are applicable, would like to know the running cycle for the change, if our code already used "System .Web.Caching" class for caching, will the code override the global settings for specific objects?
Q4) Would like to know if any technical reference / article can support us if we wouldn't follow this recommendation. (False positive / Not an issue?)
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
None
0 Points
2 Posts
How to set no cache in http header via web server configuration instead of code change and its ru...
Jan 17, 2018 04:22 AM|august80|LINK
Hi All, may I ask your help for no cache settings? we would like to avoid code change but not sure the technical approach.
Background
We are hosting the internet facing ASP.net application.
the security report just said the following HTTP headers need to be set through either the application framework or within the web server configuration:
Cache-Control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
Expires: 0
Pragma: no-cache
However, our code already used "System .Web.Caching" class for caching for some useful objects.
Questions
Q1) How can I use web server configuration (e.g. web.config) for above settings?
Q2) If Q1 is not applicable, how can I update it by global ASAX File?
Q3) If Q1/Q2 are applicable, would like to know the running cycle for the change, if our code already used "System .Web.Caching" class for caching, will the code override the global settings for specific objects?
Q4) Would like to know if any technical reference / article can support us if we wouldn't follow this recommendation. (False positive / Not an issue?)
Thank you for your attention. :)
Star
9591 Points
3012 Posts
Re: How to set no cache in http header via web server configuration instead of code change and it...
Jan 18, 2018 02:32 AM|Brando ZWZ|LINK
Hi august80,
Do you mean you want to add custom header in the response?
If this is your requirement, I suggest you could try to use below web.config setting.
Result:
Best Regards,
Brando
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
None
0 Points
1 Post
Re: How to set no cache in http header via web server configuration instead of code change and it...
Mar 26, 2019 07:44 AM|Tim H|LINK
Thank you so much for your reply @Brando
I've sitting since hours on that case. Now its solved.