Asp.Net完美隐藏服务器信息

时间:2021-08-12 18:15:32

首先在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