如何从标头中删除有关IIS的信息

时间:2013-07-07 20:44:42

标签: c# asp.net httpresponse response-headers

我想从Response Headers中删除有关IIS版本的信息。在Global.asax中是Application_PreSendRequestContent事件,或者我可以实现IHttpModule并在以下位置执行:

void context_PreSendRequestContent(object sender, EventArgs e)
    {
        HttpContext context = ((HttpApplication)sender).Context;
...

static void OnPreSendRequestHeaders(object sender, EventArgs e)
    {
        // remove the "Server" Http Header
        HttpContext.Current.Response.Headers.Remove("Server");

但是当我想阅读context.Response.Headers属性时,我收到错误:{"This operation requires IIS integrated pipeline mode."}。我有Windows XP和VS 2008.

由于

0 个答案:

没有答案