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