How do I combine WebResource.axd and ScriptResource.axd files so as to result in less requests to my ASP.NET server?

喜夏-厌秋 提交于 2019-11-26 19:25:59

问题


On a site I'm working on, the pages are generating 45 external WebResource.axd and ScriptResource.axd files so the broswers have to request all 45 references. That's a lot of references so I'd like to know if there is a way that all of those requests could be combined into one request? I've seen that the Script Manager is supposed to be able to do something regarding that but I haven't seen any results with the WebResource.axd and ScriptResource.axd files.

How would I go about getting these to all combine?


回答1:


As the others have stated, using the ASP.NET AJAX Toolkit's ToolkitScriptManager rather than the default ASP.NET ScriptManager will allow you to do some script combining, including your own scripts embedded as resources - there's a good post about it at Script combining made easy.

If you have the luxury of using ASP.NET 3.5 SP1, then there are some further additions to the ASP.NET ScriptManager that allow you to combine a lot more scripts, including general .js files in your solution into one script call.

Check out the video here:

Using Script Combining to Improve Performance




回答2:


Try using ajax - ToolkitScriptManager instead of asp - ScriptManager - it tends to combine as much of the resource requests as it can.




回答3:


here is a CodeProject article for both version of frameworks 2.0 & 3.5



来源:https://stackoverflow.com/questions/505416/how-do-i-combine-webresource-axd-and-scriptresource-axd-files-so-as-to-result-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!