How to remove ASP.Net MVC Default HTTP Headers?

前端 未结 11 2192
自闭症患者
自闭症患者 2020-11-28 01:23

Each page in an MVC application I\'m working with sets these HTTP headers in responses:

X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
X-AspNetMvc-Version         


        
11条回答
  •  温柔的废话
    2020-11-28 01:49

    You can change any header or anything in Application_EndRequest() try this

    protected void Application_EndRequest()
    {
        // removing excessive headers. They don't need to see this.
        Response.Headers.Remove("header_name");
    }
    

提交回复
热议问题