Remove “Server” header from ASP.NET Core 2.1 application

前端 未结 4 1044
[愿得一人]
[愿得一人] 2021-02-07 00:23

Is it possible to remove the Server Response header in a ASP.NET Core 2.1 application (running on Server 2016 with IIS 10)?

I tried putting the followin

4条回答
  •  别跟我提以往
    2021-02-07 00:43

    This solution works on IIS 10+ version and allows to remove x-powered-by and server headers in server response.

    In IIS 10 a new attribute was added: removeServerHeader.

    We need to create web.config file in asp.net core application with following content:

    
    
      
        
          
        
        
          
            
          
        
      
    
    

    Then publish app and restart site on IIS.

提交回复
热议问题