IIS和.NET系统类型与版本信息泄露解决方法

修改web.config(红色部分为要添加的)

<configuration>
  <system.web>
     <compilation debug="true" targetFramework="4.5"/>
     <httpRuntime requestValidationMode="2.0" enableVersionHeader="false"/>
     <customErrors mode="Off"/>
     <webServices>
   <!--允许其他机器调试WEB服务-->
  <protocols>
    <add name="HttpSoap"/>
    <add name="HttpPost"/>
    <add name="HttpGet"/>
    <add name="Documentation"/>
  </protocols>
     </webServices>
  </system.web>
  <system.webServer>
  <httpProtocol>
    <customHeaders>
      <remove name="X-Powered-By" />
    </customHeaders>
  </httpProtocol>
   </system.webServer>
</configuration>

 

添加Global类

添加方法

protected void Application_PreSendRequestHeaders()
{
   Response.Headers.Remove("Server");
}

posted on 2020-11-04 21:14  梦一尘  阅读(1822)  评论(0编辑  收藏  举报