I'm using MbCompression library and I'm want to know - does MbCompression minifies ScriptResource.axd? And are there any tools that can minimify ScriptResource.axd at runtime with minimum changes to web.config?
1 Answers
I'm not familiar with MbCompression, but do take a look at RequestReduce. This is an OSS project of mine and I believe it does exactly what you want: minifies/combines css and javascript at runtime. Unlike other frameworks, RequestReduce requires no code changes, no rearrangement of scripts and css and VERY little config. All the config necessary is to add the module. Here is all you really need in your config:
<system.web>
<httpModules>
<add name="RequestReduce" type="RequestReduce.Module.RequestReduceModule, RequestReduce"/>
</httpModules>
</system.web>
<system.webServer>
<modules>
<validation validateIntegratedModeConfiguration="false"/>
<add name="RequestReduce" type="RequestReduce.Module.RequestReduceModule, RequestReduce"/>
</modules>
</system.webServer>
That's it and no extra code. There are a bunch of options you have access to to turn various things on and off and configure cache syncing across multiple servers or include a CDN host in your urls. But for an out of the box solution, just the above should be necessary.
It will look for any script url and will minify it and merge it with adjacent script tag contents as long as the following are true:
- The mime type of the url is a valid javascript mime type. So ScriptResources and WebResources should be caught.
- The url does not have a no-cache or no-store cache-control header.
- The url does not have a max-age or expires header less than a week.
I have heard accounts of people complaining that webresource.axd or scriptresource.axd get sent to the browser with no-cache set. This may not be an issue for you but if you see this happening and the lack of caching is not intentional, you can add this to your web.config:
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="180.00:00:00" cacheControlCustom="public" />
</staticContent>
In addition, it can automatically sprite any background images, optimize their PNG compression and it uses best practices when serving cache headers for its cached css/javascript/sprites.
This framework is currently used at Microsoft by MSDN and Technet galleries.
You can either install via Nuget (suggested) or download from http://www.requestreduce.com.

- 6,590
- 29
- 23
-
That could be very great tool! But I have some issues. I've installed your tool manually(put refernce and add changes to config). But there is no RequestReduceContent folder. Is there anything more that I should do to install your tool manually? – user1016945 Nov 03 '11 at 16:39
-
Could be that the account which your site runs under does not have write access to your web root? If that's not it, please file an issue on my github page https://github.com/mwrock/RequestReduce/issues and I'd be happy to work with you to get it up and running. Also see this wiki on troubleshooting: https://github.com/mwrock/RequestReduce/wiki/RequestReduce-is-not-working.-I-don%27t-see-any-spriting-or-minification.-How-can-I-troubleshoot-this%3F – Matt Wrock Nov 03 '11 at 16:59
-
I already checked all permissions, but I still can't see the folder.My site is running under IIS6. May it be that I missed some configuration setting, because not installed via Nuget? – user1016945 Nov 04 '11 at 08:11
-
@MattWrock Does this works on IIS6 with asp.net 3.5 site using Ajaxcontrol tool kit ? Please let me know. – NoobDeveloper Mar 21 '12 at 18:40
-
It does work on IIS6 .net3.5. There are some issues if the javascript is referencing other scripts using relative urls since the scripts are relocated. Certainly worth a try. – Matt Wrock Mar 21 '12 at 22:13