js.axd webpage error - Compress WebResource.axd disabled

Topics: ASP.NET 2.0
Jun 1, 2011 at 11:51 AM

I've deployed the web version, and a compiled from source version. The source worked on my local machine.

Both when deployed to my hosting server give this error when viewing the front page. This is deployed to a sub-domain, but the same issue presents if I deploy to the top domain.

I've seen other posts with issues relating to js.axd, they seem to suggest disabling Compress WebResource.axd. I've done this, it makes no difference.



Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.0; chromeframe/11.0.696.71; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET CLR 1.1.4322; InfoPath.2; .NET4.0C; .NET4.0E)
Timestamp: Wed, 1 Jun 2011 11:46:35 UTC

Message: Expected ')'
Line: 16
Char: 14647
Code: 0
URI: http://blog.itsphere.co.uk/js.axd?path=Scripts%2fjquery.validate.min.js

Message: Syntax error
Line: 2
Char: 9619
Code: 0
URI: http://blog.itsphere.co.uk/js.axd?path=Scripts%2fjquery-jtemplates.js

Message: Expected ')'
Line: 1
Char: 12644
Code: 0
URI: http://blog.itsphere.co.uk/js.axd?path=Scripts%2fblog.js&minify=

Message: 'BlogEngine' is undefined
Line: 1
Char: 1
Code: 0
URI: http://blog.itsphere.co.uk/res.axd?lang=en-us

Message: Expected '}'
Line: 1
Char: 7841
Code: 0
URI: http://blog.itsphere.co.uk/js.axd?path=%2fadmin%2fwidget.js&minify=

Message: Object expected
Line: 346
Char: 1
Code: 0
URI: http://blog.itsphere.co.uk/


Jun 2, 2011 at 5:59 AM

It looks like in the JS files that are being minified, the last few characters are missing.  For example, with jquery.validate.min.js, it should end like what's below, but the part shown in bold/red is missing on your website:


Same with blog.js, and probably the others too.  But I do see that on your site, the pre-minified files appear to be intact.  So it's during the minification process when these trailing characters are being dropped.

My guess offhand is that before you uploaded them to the site, or during the upload process, the content encoding of the files has changed.  Out of the box, these JS files are UTF-8.  It's possible the encoding got messed up and when the files are being read on the server, the length of the document is being incorrectly determined because of the Unicode BOM.

I would try opening up these JS files in a text editor or VS, and resave them, and then re-upload them to the site.  It'll be jquery.validate.min.js, blog.js, jquery-templates.js in the Scripts folder, and widget.js in the admin folder.  At least those are the ones reported in the above error messages.  Not sure if this will solve the problem, but worth trying.

Jun 2, 2011 at 12:48 PM

you're right! There is something odd going on with the encoding of the files.

I've re-saved the JS files using the web file manager provided by my host and they start working.

All except blog.js and widget.js, which I presume are being minified on fly? The generated minified versions are still missing characters. So there is something weird about the way the server is generating the minified versions.