首先在Global.asax.cs里增加:
protected void Application_PreSendRequestHeaders(object sender, EventArgs e)
{
HttpContext.Current.Response.Headers.Set("Server", "w3cnet.com");
HttpContext.Current.Response.Headers.Remove("X-AspNet-Version");
HttpContext.Current.Response.Cookies.Remove(".ASPXAUTH");
}
然后web.config的system.webServer节点下增加:
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
</customHeaders>
</httpProtocol>
再看看响应头,或用站长工具查看,完美隐藏。
参考资料:
http://www.yn-s.com/news/Details/93