ASP.NET 4.5アプリが共有ホスティングに展開されているため、IIS設定にアクセスできません。X-Powered-By
ヘッダーを削除するには、次のように指定しweb.config
ます。
<system.webServer>
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
</customHeaders>
</httpProtocol>
</system.webServer>
そして、Server
ヘッダーを削除するには、次のように指定しますGlobal.asax
。
protected void Application_PreSendRequestHeaders(object sender, EventArgs e) {
HttpContext.Current.Response.Headers.Remove("Server");
}
ただし、応答には引き続き両方のヘッダーが含まれます。
Cache-Control:private
Content-Encoding:deflate
Content-Length:672
Content-Type:text/html; charset=utf-8
Date:Sun, 06 Jan 2013 00:41:20 GMT
Server:Microsoft-IIS/7.5
X-Powered-By:ARR/2.5
X-Powered-By:ASP.NET
どうすれば削除できますか?