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

查看:26
本文介绍了删除服务器响应标头 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天全站免登陆