I use HTTP Module to compress Requests, this is my implementation:
void context_Begin(object sender, EventArgs e)
{
HttpApplication app = (HttpApplication)sender;
string encoding = app.Request.Headers.Get("Accept-Encoding");
if (encoding == null)
return;
Stream baseStream = app.Response.Filter;
if (encoding.Contains("gzip"))
{
app.Response.Filter = new GZipStream(baseStream, CompressionMode.Compress);
app.Response.AppendHeader("Content-Encoding", "gzip");
}
else if (encoding.Contains("deflate"))
{
app.Response.Filter = new DeflateStream(baseStream, CompressionMode.Compress);
app.Response.AppendHeader("Content-Encoding", "deflate");
}
}
So every thing is fine at all, just a weird behavior with main url:
All Pages worked perfectly except main URL, my main url is: www.mynewsite.com, if I disable HTTP Module every thing is fine but when enable it I get the 404 error with main url: The resource can not be found.
I don't understand? what is the relation between this page and Request Compression?
Does any one have any idea about this? any suggestion?