asp. net of C disallows caching files from the client side

  • 2021-01-11 01:58:21
  • OfStack

IIS caches the file to the client by file address and parameters so that it is faster to access the content again. If you want to remove this mechanism, you need to disable caching files.

1. Programming style


Response.Buffer = true;
Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);
Response.Cache.SetExpires(DateTime.Now.AddDays(-1));
Response.Expires = 0;
Response.CacheControl = "no-cache";

2. Code


<%@ OutputCache Duration="1" varybyparam="none" Location= "None" %>


Related articles: