MvcScriptManager is aimed to port certain key features available in AjaxControlToolkit's ToolkitScriptManager into the current ASP.NET MVC Framework. You will be able to use it as a control in your ASP.NET MVC application.
- Script combination (or concatenation). Scripts declared with MvcScriptManager will be combined on the fly into a single script file request when the page is rendered.
- Script minification (or crunching) in release mode. Minification process is done only once at the first request that references the specific script. Subsequent requests will use the crunched script content in cache (see #5 for detail). Crunching can be
enabled/disabled for each script.
- Render localized resources for stand-alone script files. Localized strings will be appended to the script if specified.
- Support configurable HTTP compression and expiration setting when outputing scripts.
- Script caching with file dependency. Script file content is cached so that rendering combined script file will be much more performant. Cache dependency is linked to the physical file therefore any script update in the file system will be reflected in the
- Support rendering scripts in debug/release mode based on the running environment.
- Resolving different paths for stand-alone script files.
- Support multiple MvcScriptManagers on a single page (or master page). Support both Master and Slave rendering mode so that scripts declared with one ScriptManager can be rolled over to another one for rendering.
- Suport web farm scenario.
What MvcScriptManager Won't Offer
Below are the things MvcScriptManager doesn't (and probably won't) offer in case you are used to using the ScriptManager and assume these features are included:
- Support for ASP.NET Ajax extensibility model. In my opinion, with ASP.NET MVC Framework and jQuery, writing ajax script/extender controls is no longer necessary.
- Support for embedded script files. We should avoid embedding script files in assembly anyway because updates of script will require a rebuild of the project which is not ideal.
- Provide access to web methods from script by registering web services. This is overhead and you can totally avoid it by either using jQuery’s AJAX utilities or Sys.Net.WebServiceProxy class available in ASP.NET AJAX client library.
- Support UpdatePanel and partial-page Rendering.
How to Use MvcScriptManager
Please see the attached