There is a form which contain a tabcontainer and watermark control from ajaxcontroltoolkit. It's Giving java error: Sys.Extended is undefined when using the following gzip procedure. The following code is from Global.asax file :
void Application_PreRequestHandlerExecute(object sender, EventArgs e)
{
HttpApplication app = sender as HttpApplication;
string acceptEncoding = app.Request.Headers["Accept-Encoding"];
Stream prevUncompressedStream = app.Response.Filter;
if (!(app.Context.CurrentHandler is Page ||
app.Context.CurrentHandler.GetType().Name == "SyncSessionlessHandler") ||
app.Request["HTTP_X_MICROSOFTAJAX"] != null)
return;
if (acceptEncoding == null || acceptEncoding.Length == 0)
return;
acceptEncoding = acceptEncoding.ToLower();
if (acceptEncoding.Contains("deflate") || acceptEncoding == "*")
{
// defalte
app.Response.Filter = new DeflateStream(prevUncompressedStream,
CompressionMode.Compress);
app.Response.AppendHeader("Content-Encoding", "deflate");
}
else if (acceptEncoding.Contains("gzip"))
{
// gzip
app.Response.Filter = new GZipStream(prevUncompressedStream,
CompressionMode.Compress);
app.Response.AppendHeader("Content-Encoding", "gzip");
}
}
When I remove the above code the error is gone and everything works fine.
This is the control tag from web.config:
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="ajaxToolkit" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit"/>
<add tagPrefix="HTMLEditor" namespace="AjaxControlToolkit.HTMLEditor" assembly="AjaxControlToolkit"/>
</controls>
When I run alert(Sys.Extended.UI.TabPanel); in firebug console I got error "Sys.Extended is undefined". But when I run only alert(Sys.Extended); is gives message "undefined" not error. Does this makes any sense?. And I also wants to mention that when I save the page from browser I gives a message "default.js could not be saved, because the source file could not be read" and I didn't find the .js file of page in page default_files folder. But when I remove the gzip code from global.asax file I found the default.js file in default_files folder.