首先在Global.asax.cs里增加:

protected void Application_PreSendRequestContent(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://fenglongsheng.com/post/7566.html

04-19 13:12