Compress and Minify WebResource.axd and ScriptResource.axd in ASP.NET 4 WebForms

倾然丶 夕夏残阳落幕 提交于 2019-12-19 21:54:24

问题


I have been trying for a week now to reduce the number of requests on our web application but I can't seem to combine the .axd files. I got a suggestion from somewhere which worked locally (development box) but doesn't work on our test and production environment as they are both on HTTPS. The developer didn't comment on that and the component he wrote was last updated in 2011. (I will find the link and update this post).

I tried using the CompositeScript in ScriptManager and again it doesn't work on Test/Production environments.

I used SquishIt to resolve the other files. (see attachment)


回答1:


To force it work on your environment, set ScriptMode="Release" eg as:

<asp:ScriptManager ID="ScrMang" runat="server" ScriptMode="Release"  >
    <CompositeScript>
    <Scripts>
        <asp:ScriptReference name="MicrosoftAjax.js"/>
        <asp:ScriptReference name="MicrosoftAjaxWebForms.js"/>
        <asp:ScriptReference name="Common.Common.js" assembly="AjaxControlToolkit"/>
    </Scripts>
    </CompositeScript>
</asp:ScriptManager>

Some more notes

To find what scripts to add inside CompositeScript you can use the code from here : http://aspnet.codeplex.com/releases/view/13356 and get more help how to use it from this page : https://lancezhang.wordpress.com/2008/11/15/aspnet-ajax-performance/



来源:https://stackoverflow.com/questions/28111870/compress-and-minify-webresource-axd-and-scriptresource-axd-in-asp-net-4-webforms

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