close

在公司遇到資安問題, 在這統整解決之參考方案, 未來持續新增

參考網站:  ASP.NET Core 教學 - 移除 Response Header 資訊

2
3
4
5
6
7
8
9
10
11
12
13
14
15
public class Program
{
    public static void Main(string[] args)
    {
        var host = new WebHostBuilder()
            .UseKestrel(c => c.AddServerHeader = false)
            .UseContentRoot(Directory.GetCurrentDirectory())
            .UseIISIntegration()
            .UseStartup<Startup>()
            .UseApplicationInsights()
            .Build();

        host.Run();
    }
}

 

 Web.config

1
2
3
4
5
6
7
8
9
10
11
<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.webServer>
        <!-- ... -->
        <httpProtocol>
            <customHeaders>
                <remove name="X-Powered-By" />
            </customHeaders>
        </httpProtocol>
    </system.webServer>
</configuration>
arrow
arrow
    全站熱搜

    程式小試身手 發表在 痞客邦 留言(0) 人氣()