i am trying to compress the webpages of my website to increase its speed. i am done with JS and CSS compression. now i want to compress my aspx pages before the response is out. i am using this code in global.asax file of my website
void Application_Start(object sender, EventArgs e)
{
HttpContext incoming = HttpContext.Current;
string oldpath = incoming.Request.Path.ToLower();
incoming.Response.Filter = new System.IO.Compression.GZipStream(incoming.Response.Filter, System.IO.Compression.CompressionMode.Compress);
HttpContext.Current.Response.AppendHeader("Content-encoding", "gzip");
HttpContext.Current.Response.Cache.VaryByHeaders["Accept-encoding"] = true;
}
it donot gives error in visual studio. but when i put this code on IIS, it gives error/exception
Exception Details: System.Web.HttpException: Request is not available in this context
can anyone suggest or explain what should i do.