##環境
windows server 2008 R2
IIS 8.0
##Serverを消す
Global.asax.cs
protected void Application_PreSendRequestHeaders(){
Response.Headers.Remove("Server");
}
##X-AspNetMvc-Versionを消す
Global.asax.cs
protected void Application_Start(){
MvcHandler.DisableMvcResponseHeader = true;
AreRegistration.RegisterALLAreas();
}
##X-AspNet-Versionを消す
Web.config
<system.web>
:
<httpRuntime enableVersionHeader ="false" />
:
</system.web>
##X-Powered-Byを消す
Web.config
<system.webServer>
:
<httpProtocol>
<customHeaders>
<remove name ="X-Powered-By" /> //addで任意のヘッダを追加できる(X-Frame-Optionsなど)
</customHeaders>
<httpProtocol>
:
</system.webServer>
反映されない場合はIISを再起動。
HTTP層で管理されているものがGlobal.asax.cs、
Webアプリケーション層で管理されているものがWeb.configを編集
という認識であっているのか...