I created a custom module:
namespace KittenFarm.ServerModules { public class CustomServerHeaderModule : IHttpModule { public void Init(HttpApplication context) { context.PreSendRequestHeaders += OnPreSendRequestHeaders; } public void Dispose() { } void OnPreSendRequestHeaders(object sender, EventArgs e) { HttpContext.Current.Response.Headers.Remove("Server"); } } }
And I registered it in my web config:
<system.webServer> <validation validateIntegratedModeConfiguration="false"/> <modules runAllManagedModulesForAllRequests="true"> <add name="CustomServerHeader" type="CustomServerHeaderModule" /> </modules> ....
However, it never starts.
I suspected it was a namespace problem, but I tried every combination of namespaces in the type= section that I can think of, and it never hits the breakpoint that I inserted into it.
Any ideas?
source share