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