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");
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM