none
WebForms ReportViewer loading scripts from HTTP instead of HTTPS RRS feed

  • Question

  • I have a site deployed with SSL. The ReportViewer control is trying to load resources from a Microsoft site using HTTP rather than HTTPS. Chrome complains about not being able to load this resource because it won't allow mixed schemes. Specifically it is MicrosoftAjaxTimer.js

    I found a workaround as follows (In the Page_Load of the page containing the ReportViewer control):

                if (!Context.IsDebuggingEnabled)
                {
                    var sm = ScriptManager.GetCurrent(this);
                    sm.AsyncPostBackTimeout = 1800;
    
                    sm.Scripts.Add(new ScriptReference
                    {
                        Name = "MicrosoftAjaxTimer.js",
                        Path = Request.Url.Scheme + "://ajax.aspnetcdn.com/ajax/4.6/1/MicrosoftAjaxTimer.js"
                    });
                }


    For reference, here is how I'm showing the control:

    <form id="form1" runat="server" style="height: 100%">
        <asp:ScriptManager runat="server" EnableCdn="true" AsyncPostBackTimeout="56000"></asp:ScriptManager>        
        <rsweb:ReportViewer ID="ReportViewer" runat="server" ProcessingMode="Remote" Width="100%" Height="98%" OnSubmittingParameterValues="SubmitParameters" />
    </form>

    The workaround seems really brittle. Is this really how to make scripts referenced by ReportViewer work properly over HTTPS? It seems like I'd have to always remember to update this code whenever I upgrade versions. Would rather not have to do that if possible.

    Monday, October 21, 2019 4:26 AM