When using the control toolkit with bundling and the CDN, there is no fallback for the CDN.
If the CDN is unavailable, the script fails to load.
As a workaround, I have inserted the code below into the master page.
Is there a better way to solve this issue?
```
<asp:ScriptManager runat="server" ScriptMode="Release" EnablePartialRendering="true" EnableScriptGlobalization="true" EnableScriptLocalization="true" EnableCdn="true" EnableCdnFallback="true">
<Scripts>
<!-- other script references -->
<asp:ScriptReference Path="~/Scripts/AjaxControlToolkit/Bundle" />
</Scripts>
</asp:ScriptManager>
<script type="text/javascript">
//<![CDATA[
(Sys.Extended) || document.write('<script type="text/javascript" src="Scripts/AjaxControlToolkit/Bundle"><\/script>');//]]>
</script>
```
Comments: I managed to reproduce the issue. I made a fix for the CDN fallback and attached an updated version of the project to this thread. Due to the upload size limitation, I attached two packages "AjaxControlToolkit.15.1.4.29.zip" and "AjaxControlToolkit.StaticResources.15.1.4.29.zip". Unzip and put these packages into the root "packages" folder of your project. Please note the changes that were made in the project: 1) EnableOptimizations is set to true in Global.asax.cs ``` BundleTable.EnableOptimizations = true; ``` 2) "~/Scripts/AjaxControlToolkit/Bundle" is rendered with the Scripts.Render() method in the asp:PlaceHolder section instead of the ScriptReference item in ScriptManager. ``` <asp:PlaceHolder runat="server"> <%: Scripts.Render("~/bundles/modernizr") %> <%: Scripts.Render("~/Scripts/AjaxControlToolkit/Bundle") %> </asp:PlaceHolder> ``` 3) AJAX Control Toolkit NuGet packages were replaced with updated packages.
If the CDN is unavailable, the script fails to load.
As a workaround, I have inserted the code below into the master page.
Is there a better way to solve this issue?
```
<asp:ScriptManager runat="server" ScriptMode="Release" EnablePartialRendering="true" EnableScriptGlobalization="true" EnableScriptLocalization="true" EnableCdn="true" EnableCdnFallback="true">
<Scripts>
<!-- other script references -->
<asp:ScriptReference Path="~/Scripts/AjaxControlToolkit/Bundle" />
</Scripts>
</asp:ScriptManager>
<script type="text/javascript">
//<![CDATA[
(Sys.Extended) || document.write('<script type="text/javascript" src="Scripts/AjaxControlToolkit/Bundle"><\/script>');//]]>
</script>
```
Comments: I managed to reproduce the issue. I made a fix for the CDN fallback and attached an updated version of the project to this thread. Due to the upload size limitation, I attached two packages "AjaxControlToolkit.15.1.4.29.zip" and "AjaxControlToolkit.StaticResources.15.1.4.29.zip". Unzip and put these packages into the root "packages" folder of your project. Please note the changes that were made in the project: 1) EnableOptimizations is set to true in Global.asax.cs ``` BundleTable.EnableOptimizations = true; ``` 2) "~/Scripts/AjaxControlToolkit/Bundle" is rendered with the Scripts.Render() method in the asp:PlaceHolder section instead of the ScriptReference item in ScriptManager. ``` <asp:PlaceHolder runat="server"> <%: Scripts.Render("~/bundles/modernizr") %> <%: Scripts.Render("~/Scripts/AjaxControlToolkit/Bundle") %> </asp:PlaceHolder> ``` 3) AJAX Control Toolkit NuGet packages were replaced with updated packages.