Created
July 16, 2012 18:28
-
-
Save dax70/3124173 to your computer and use it in GitHub Desktop.
Disabling Response Headers Code Centric
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void Application_PreSendRequestHeaders(object sender, EventArgs e) | |
{ | |
HttpContext.Current.Response.Headers.Remove("Server"); | |
HttpContext.Current.Response.Headers.Remove("X-Powered-By"); // Disabled in config | |
HttpContext.Current.Response.Headers.Remove("X-AspNet-Version"); // Disabled in config | |
HttpContext.Current.Response.Headers.Remove("X-AspNetMvc-Version"); // Disabled on Application_Start | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add the following to the Globals.asax or class that inherits from HttpApplication to remove Response Headers.