Ngày mới An Nhiên » Noted » Removing X-Powered-By ASP.Net

Removing X-Powered-By ASP.Net

Do not show response header

Server Microsoft-IIS/7.5
X-AspNetMvc-Version 3.0
X-AspNet-Version 4.0.303319
X-Powered-By ASP.NET
Removing X-AspNet-Version

Web.config


Removing X-AspNetMvc-Version

Global.asax.cs

protected void Application_Start()
{
MvcHandler.DisableMvcResponseHeader = true;
}

Removing or changing Server

In Global.asax.cs add this:

protected void Application_PreSendRequestHeaders()
{
//Response.Headers.Remove(“Server”); //Remove header
Response.Headers.Set(“Server”,”ServerName”); //Change Server header
Response.Headers.Remove(“X-AspNet-Version”); //alternative to above solution
Response.Headers.Remove(“X-AspNetMvc-Version”); //alternative to above solution
}

Removing or changing X-Powered-By

IIS 7 – You can also remove the X-Powered-By header by including these lines to the element:





or manually go to IIS7 Management Console and open HTTP Response Headers

Source: https://ict.ken.be/removing-x-powered-by-aspnet-and-other-version-headers

ASP.NET C# MVC5
ASP.NET C# MVC5

Leave a Comment

Email của bạn sẽ không được hiển thị công khai.

Website này sử dụng Akismet để hạn chế spam. Tìm hiểu bình luận của bạn được duyệt như thế nào.