删除服务器响应标头IIS7 [英] Remove Server Response Header IIS7

查看:245
本文介绍了删除服务器响应标头IIS7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法从IIS7中删除服务器响应头?有一些文章显示使用HttpModules可以达到同样的效果。如果我们没有管理员权限到服务器,这将会很有帮助。我也不想编写ISAPI过滤器。

Is there any way to remove "Server" response header from IIS7? There are some articles showing that using HttpModules we can achieve the same thing. This will be helpful if we don't have admin right to server. Also I don't want to write ISAPI filter.

我对我的服务器拥有管理员权限。所以我不想做以上的事情。所以,请帮助我做同样的事情。

I have admin rights to my server. So I don't want to do the above stuff. So, please help me to do the same.

推荐答案

将此添加到您的global.asax.cs中:

Add this to your global.asax.cs:

protected void Application_PreSendRequestHeaders()
{
    Response.Headers.Remove("Server");
    Response.Headers.Remove("X-AspNet-Version");
    Response.Headers.Remove("X-AspNetMvc-Version");
}

这篇关于删除服务器响应标头IIS7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆