【问题标题】:how to remove response headers for image css and js requests如何删除图像 css 和 js 请求的响应标头
【发布时间】:2015-01-08 21:54:25
【问题描述】:

我已经部署了一个网络应用程序

我想删除服务器信息,我可以通过在global.asax 中添加这些行来在处理程序中实现它,就像建议的here 一样

 protected void Application_BeginRequest(object sender, EventArgs e)
        {
            var application = sender as HttpApplication;
            if (application != null && application.Context != null)
            {
                application.Context.Response.Headers.Remove("Server");
            }

        }

现在这会删除 XHR 请求的标头,但我仍然能够在图像请求的响应标头中找到服务器信息!如何删除它们?

【问题讨论】:

    标签: c# asp.net iis windows-server-2008


    【解决方案1】:

    我在这里发现了另一个类似的问题。主要的答案是将其添加到您的 web.config 中:

    <system.webServer>     
      <modules runAllManagedModulesForAllRequests="true">     
       </modules>     
    </system.webServer>
    

    在这里查看所有答案:Removing Server header from static content in IIS 7/8

    【讨论】:

    • 我应该在 system.web 下添加吗
    猜你喜欢
    • 2016-12-28
    • 1970-01-01
    • 1970-01-01
    • 2016-05-06
    • 2016-11-01
    • 2011-12-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多