先安装url-rewrite组件
http://www.iis.net/downloads/microsoft/url-rewrite

修改应用根目录下的Web.config配置文件
<configuration>
...
<system.webServer>
...
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
</customHeaders>
</httpProtocol>
<rewrite>
<outboundRules rewriteBeforeCache="true">
<rule name="Remove Server header">
<match serverVariable="RESPONSE_Server" pattern=".+" />
<action type="Rewrite" value="Apache" />
</rule>
</outboundRules>
</rewrite>
</system.webServer>
</configuration>

隐藏X-AspNet-Version

<configuration>
...
<system.web>
<compilation targetFramework="4.6.1" />
<httpRuntime enableVersionHeader="false" />
<!--httpRuntime targetFramework="4.6.1" maxRequestLength="40960" /-->
</system.web>
</configuration>

删除X-AspNetMvc-Version

在Global.asax的Application_Start事件中将MvcHandler类的DisableMvcResponseHeader属性设置为True
MvcHandler.DisableMvcResponseHeader = True

删除X-Powered-By

IIS8中移除X-Powered-By HTTP头的步骤:

1 打开IIS管理器
  2 展开 网站 选择对应的项目并双击 HTTP响应标头
  3 删除相应的头信息

转自:https://www.cnblogs.com/cpw6/p/15767703.html

参考内容:https://github.com/dionach/StripHeaders

最新文章

  1. MVC调试时遇到的URL问题
  2. NSScanner知悉 (转)
  3. 关于JS
  4. 2014牡丹江K Known Notation
  5. TeeChart Pro 5.0
  6. android 图片进度条
  7. xargs -n1 -t
  8. 使用swiper和吸顶效果代码
  9. asp.net读取excel文件多种方法
  10. (转)关于ARM9协处理器CP15及MCR和MRC指令
  11. odoo view field option, action flage 参数
  12. css 中 的 float :left 和 clear :both
  13. 常用渗透性测试工具(Tools for penetration testing)
  14. Struts2+Spring3+Hibernate3+Maven构建(基于Eclipse)
  15. 第1个linux命令——echo
  16. robotframework自动化系列:随机下拉框
  17. 【.Net】优秀的开源框架
  18. MySQL主从同步添加至zabbix监控
  19. Open Tools API :IDE Main Menus
  20. 浅谈SVG(可缩放的矢量图形)

热门文章

  1. Android:DrawerLayout 抽屉布局没有反应
  2. C语言学习--动态内存分配(未完待续)
  3. 【3】java之string类
  4. windows 服务删除或停止
  5. RIDE,如何指定report,log,output的存放位置
  6. vscode 中用git命令合并分支
  7. reids 启动方法
  8. datax缺少clickhouse reader插件
  9. react native SectionList组件实现多选
  10. AR设备使用Vuforia的优化