Disable browser cache for entire ASP.NET website

前端 未结 8 1651
既然无缘
既然无缘 2020-11-22 03:20

I am looking for a method to disable the browser cache for an entire ASP.NET MVC Website

I found the following method:

Response.Cach         


        
8条回答
  •  南旧
    南旧 (楼主)
    2020-11-22 04:17

    UI

    <%@ OutPutCache Location="None"%>
    <%
        Response.Buffer = true;
        Response.Expires = -1;
        Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1);
        Response.CacheControl = "no-cache";
    %>
    

    Background

    Context.Response.Cache.SetCacheability(HttpCacheability.NoCache); 
    Response.Expires = -1;          
    Response.Cache.SetNoStore();
    

提交回复
热议问题