Friday, 23 August 2013

iis error when removing server header

iis error when removing server header

I have written these lines to remove server headers in Global.asax:
protected void Application_PreSendRequestHeaders(object sender, EventArgs e)
{
var app = sender as HttpApplication;
if (app == null || !app.Request.IsLocal || app.Context == null)
return;
var headers = app.Context.Response.Headers;
headers.Remove("Server");
}
But when I set a break point there I see this error:
This operation requires IIS integrated pipeline mode.
I am using asp.net mvc 4 and my iis version is 7.5
By the way I have set both Classic.Net AppPool and Default AppPool
pipeline modes to Integrated but the error exist yet.
What should I try?
Thanks.

No comments:

Post a Comment