删除 ASP.NET MVC6 服务器 header
Remove ASP.NET MVC6 Server header
来自 ASP.NET MVC6 应用程序的 HTTP 响应具有 header Server: Microsoft-HTTPAPI/2.0
我要remove/change这个header。我尝试添加一个过滤器来替换 header
public class RemoveServerHeaderFilter : IActionFilter
{
public void OnActionExecuted(ActionExecutedContext context)
{
context.HttpContext.Response.Headers.Set("Server", "Replaced");
}
public void OnActionExecuting(ActionExecutingContext context)
{
}
}
我得到了 Server: Replaced Microsoft-HTTPAPI/2.0
的意外和不需要的结果
有没有办法替换这个?
我认为这个header不是来自框架而是来自IIS,this article shows 3 different techniques to remove it
来自 ASP.NET MVC6 应用程序的 HTTP 响应具有 header Server: Microsoft-HTTPAPI/2.0
我要remove/change这个header。我尝试添加一个过滤器来替换 header
public class RemoveServerHeaderFilter : IActionFilter
{
public void OnActionExecuted(ActionExecutedContext context)
{
context.HttpContext.Response.Headers.Set("Server", "Replaced");
}
public void OnActionExecuting(ActionExecutingContext context)
{
}
}
我得到了 Server: Replaced Microsoft-HTTPAPI/2.0
有没有办法替换这个?
我认为这个header不是来自框架而是来自IIS,this article shows 3 different techniques to remove it