I was working on a custom .Net CMS that needs optimization. To analyze the performance of a particular page, we were using the PageSpeed Insights and Pingdom tools.
The PageSpeed Insights recommends minifying JavaScript files. After I have bundled and minified all the js files in the system, PageSpeed is still reporting the issue due to the WebResource.axd files.
The application’s WebResource.axd files come from Telerik and ASP.Net page with server-side controls.
The Telerik’s WebResource.axd file is already minified, so I have just added the ScriptMode=”Release” tag.
<telerik:RadScriptManager ID="RadScriptManager1" runat="server" ScriptMode="Release"></telerik:RadScriptManager> <telerik:RadAjaxManager ID="RadAjaxManager" runat="server"> </telerik:RadAjaxManager>
For the other WebResource.axd file, I had to create an HTTP module.
Implementation
- Write an HttpModule class named AxdCompressionModule.cs. After the axd files have been downloaded, it will be cached in the browser. The axd files will not be combined into a single file, though.
- Add settings to the web.config
<modules> <add name="AxdCompressionModule" type="ProjectName.Http.AxdCompressionModule, ProjectName" preCondition="managedHandler" /> </modules>