My ASP.NET 4.5 app is being deployed to shared hosting so I do not have access to IIS settings. To remove the X-Powered-By
header, I specify in web.config
:
<system.webServer>
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
</customHeaders>
</httpProtocol>
</system.webServer>
And to remove the Server
header, I specify in Global.asax
:
protected void Application_PreSendRequestHeaders(object sender, EventArgs e) {
HttpContext.Current.Response.Headers.Remove("Server");
}
However, responses still contain both headers:
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
How can I remove them?