Each page in an MVC application I’m working with sets these HTTP headers in responses:
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
X-AspNetMvc-Version: 2.0
How do I prevent these from showing?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
X-Powered-Byis a custom header in IIS. Since IIS 7, you can remove it by adding the following to yourweb.config:This header can also be modified to your needs, for more information refer to http://www.iis.net/ConfigReference/system.webServer/httpProtocol/customHeaders
Add this to
web.configto get rid of theX-AspNet-Versionheader:Finally, to remove
X-AspNetMvc-Version, editGlobal.asax.csand add the following in theApplication_Startevent:You can also modify headers at runtime via the
Application_PreSendRequestHeadersevent inGlobal.asax.cs. This is useful if your header values are dynamic: