Per Yahoo\'s best practices for high performance web sites, I\'d like to remove Etags from my headers (I\'m manually managing all my caching and have no need for Etags... an
I wrote a custom http module to handle this. It's really not as bad as it sounds. Here's the code:
using System;
using System.Web;
namespace StrongNamespace.HttpModules
{
public class CustomHeaderModule : IHttpModule
{
public void Init(HttpApplication application)
{
application.PostReleaseRequestState += new EventHandler(application_PostReleaseRequestState);
}
public void Dispose()
{
}
void application_PostReleaseRequestState(object sender, EventArgs e)
{
HttpContext.Current.Response.Headers.Remove("Server");
HttpContext.Current.Response.Headers.Remove("X-AspNet-Version");
HttpContext.Current.Response.Headers.Remove("ETag");
}
}
}
Here's the web.config changes you'll want: