In ASP.NET AJAX, I can set ScriptMode
for ScriptManager
.
The script mode can be Debug or Release.
What are the exact differences between them? Is it true that on debug mode, generated scripts won't cache on the browser while in R开发者_如何学编程elease mode they will be cached, and subsequent server access will be prevented?
Refering to ScriptManager.ScriptMode Property:
In Debug mode, debug versions of client script libraries are used in the Web page unless the retail attribute of the deployment configuration element is set to true.
In Release mode, release versions of client script libraries are used in the Web page unless the retail attribute of the deployment configuration element is set to false.
Refering to Debugging and Tracing Ajax Applications Overview:
The Microsoft Ajax architecture provides a model for release and debug modes. Release mode provides error checking and exception handling that is optimized for performance, with minimized script size. Debug mode provides more robust debugging features, such as type and argument checking. If you create debug versions of client script files or script resources, ASP.NET runs the debug versions when the application is in debug mode. This enables you to throw exceptions in debug scripts but still keep the size of release code to a minimum.
In release mode the ScriptManager will load the smaller, minified and unreadable JavaScript libraries. The debug version will load the actual source code with comments and good formatting but it will be slower because of the bigger size. Not that the ScriptManager will not automatically minify libraries that are not part of MS AJAX.
精彩评论