This article is a mirror article of machine translation, please click here to jump to the original article.

View: 21150|Reply: 3

[ASP.NET] asp.net Remove the X-Powered-By message from the website headers

[Copy link]
Posted on 9/19/2018 9:58:03 AM | | | |
When using IIS as a web server, the response headers of the output aspx page will always automatically include X-Powered-By, X-AspNet-Version, and Server. When using other web servers, you can often get more concise response headers. For high-load websites, saving a few response header items should also save objective traffic. From the programmer's point of view, these header items are exposed to the version used by the website program, and secondly, they also destroy the principle of simplicity. Therefore, there is always a search for ways to get rid of them.



X-AspNet-Version

Just add <httpRuntime enableVersionHeader="false" /> to the <system.web> section of the web.config file.
MSDN explains the meaning of this option as follows:

enableVersionHeader

Optional Boolean attributes.

Specifies whether ASP.NET should output version headers. Microsoft Visual Studio 2005 uses this property to determine which version of ASP.NET is currently in use. For production, this property is not required and can be disabled.

Note: This property is not available in the .NET Framework 1.0.

The default value is True.


X-Powered-By

This is the easiest, because in IIS, check the "Properties" of the website, select the "HTTP Header" tab, and you will see that there is an "X-Powered-By" option in the "Custom HTTP Header", just delete it.



X-AspNetMvc-Version

Global.asax.cs file








Previous:After configuring the httpd environment, enter: http://***/index.php to report a 404 error
Next:Buy the javascrip{filter}t handwritten signature plugin
 Landlord| Posted on 9/24/2019 4:49:03 PM |
Removed the x-powered-by: ASP.NET method

 Landlord| Posted on 3/4/2023 10:44:25 PM |
ASP.NET web.config security and performance optimization for MVC
https://www.itsvse.com/thread-10521-1-1.html
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com