Ravi Vishwakarma is a dedicated Software Developer with a passion for crafting efficient and innovative solutions. With a keen eye for detail and years of experience, he excels in developing robust software systems that meet client needs. His expertise spans across multiple programming languages and technologies, making him a valuable asset in any software development project.
ICSM Computer
05-Aug-2025To manage HTTP cache control directives like
public,private,no-cache, etc. in ASP.NET Web Forms or MVC (not Core), you typically set them in:web.config– for static content1. Set Cache Directives in
web.config(Static Content)Examples:
public– allow CDN/proxies to cache.private– only browser can cache.no-store– prevent all caching.no-cache– requires validation before use.2. Set Cache Control in ASP.NET MVC Controllers (Dynamic Content)
Use the
Response.Cacheobject.publicCache Example:privateCache Example:no-cacheExample:3. Web Forms Page Level Caching (
@OutputCache)Set caching and scope directly on
.aspxpage:Location Options:
Any→ Same aspublicClient→ Same asprivateNone→ No cachingServer→ Cache only on serverSummary of
HttpCacheabilityin ASP.NETPublicpublic, max-age=...Privateprivate, max-age=...NoCacheno-cacheNoStoreno-storeServerServerAndNoCacheno-cache(for server-side cache)View Result in Browser
Use Chrome DevTools → Network tab → click any static/dynamic response → check Headers for: