5

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)

enter image description here

RealSollyM
  • 1,530
  • 1
  • 22
  • 35

1 Answers1

8

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/

Aristos
  • 66,005
  • 16
  • 114
  • 150
  • Although this didn't minify or compress the `WebResource.axd`, it at least minified the `ScriptResource.axd`. There were cases where I had more than one `ScriptResource.axd` and it combined them as well. Thanks @Aristos for your help. – RealSollyM Jan 26 '15 at 09:10
  • @SollyM Yes you are correct, is not minified. To minified I use this https://aspnet.codeplex.com/releases/view/40584 and I pass the code from it... but if you just gZip its also ok from the manner of download speed... – Aristos Jan 26 '15 at 09:18
  • I had to unmark it as an answer. This 'CompositeScript' prevents postbacks. I have been trying to resolve postbacks while it was intact but failed. once I remove it my forms post fine. – RealSollyM Jan 26 '15 at 13:00
  • @SollyM I use this kind of script years now with out any problem. I really do not know whats your issue is with the prevent post back that you say. Hope to find it. – Aristos Jan 26 '15 at 17:23
  • @SollyM Check what is the error message, also check what kind of script reference you need to add. Here I have add some for demonstration, you need to find all your script using the above links on the answer. Probably you forget to add some scripts. – Aristos Jan 26 '15 at 17:25
  • I think the main problem is that my test/production servers run on HTTPS. Locally (development) I don't have HTTPS and therefore works fine. However when I put it on the Test server/production server it fails. HTTPS is the only thing I can think of as I set up the server myself and replicated my development box. – RealSollyM Jan 27 '15 at 09:29
  • @SollyM No its not that, I have the same https/http on my pages – Aristos Jan 27 '15 at 10:03
  • I have finally accepted this as an answer even though on my side is still doesn't work. You claim to have the solution working for your pages and therefore I cannot deny others the opportunity of using your solution if they encounter the same problem. – RealSollyM Feb 02 '15 at 14:33
  • @SollyM There is also this link on a block with full tutorial https://lancezhang.wordpress.com/2008/11/15/aspnet-ajax-performance/ the only that is not done here automatically is the minification. – Aristos Feb 02 '15 at 14:42
  • Could you please look at this and help me. http://stackoverflow.com/questions/36198461/combining-multiple-calls-to-scriptresource-axd – bjan Mar 30 '16 at 10:23
  • @bjan Yes of cource I will look at it, now I am living for 3-4 hours, later I will see it again. – Aristos Mar 30 '16 at 13:45