ASP.NET JavaScript File Embeded In DLL With GZIP

Posted by Lee Hesselden on Stack Overflow See other posts from Stack Overflow or by Lee Hesselden
Published on 2010-04-16T12:29:04Z Indexed on 2010/04/16 13:23 UTC
Read the original article Hit count: 258

Filed under:
|
|

We have several fairly large JavaScript files embedded into a single script resources DLL. This is then consumed by multiple projects by way of a reference and page includes via the ASP.NET script manager. This keeps things nice and neat within our ASP.NET pages and requires very little work to integrate into new projects.

The problem is that some of these script files are quite larger (approx 100KB) and take time to download. By running minify on them before embedding this is reduced down a lot (around 70KB) but not enough. What we would like to do is GZIP the files before they are embedded. However, just gzipping the files causes syntax errors as the content is not unzipped. There is a content type "text/javascript" applied in AssemblyInfo when the resource is embedded but we can't find a way to specify content-encoding.

Is there any way to make this work without having to write a httpmodule/handler (which would mean changing the config for all consuming projects)?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about ASP.NET