c# - ScriptManager only allows jQuery CDN fallback with Microsoft ASP.NET CDN -


how can use cdn scriptmanager cdn fallback custom jquery scriptresourcedefinition?

when use ajax.aspnetcdn.com, browser renders <script> tag cdn url, writes fallback code write new <script> tag local url.

aspx

<asp:scriptmanager id="scriptmanager" runat="server" enablepartialrendering="true" enablecdn="true" enablecdnfallback="true">     <scripts>         <asp:scriptreference name="jquery" />     </scripts> </asp:scriptmanager> 

cs

string jqueryversion = "1.11.2"; scriptmanager.scriptresourcemapping.adddefinition(     "jquery",     new scriptresourcedefinition()     {         debugpath = "~/scripts/jquery-" + jqueryversion + ".js",         path = "~/scripts/jquery-" + jqueryversion + ".min.js",         cdndebugpath = "http://ajax.aspnetcdn.com/ajax/jquery/jquery-" + jqueryversion + ".js",         cdnpath = "http://ajax.aspnetcdn.com/ajax/jquery/jquery-" + jqueryversion + ".min.js",         cdnsupportssecureconnection = true,         loadsuccessexpression = "window.jquery"     }); 

output

<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-1.11.2.min.js" type="text/javascript"></script> <script type="text/javascript"> //<![cdata[ (window.jquery)||document.write('<script type="text/javascript" src="scripts/jquery-1.11.2.min.js"><\/script>');//]]> </script> 

problem

if use code.jquery.com or ajax.googleapis.com cdn server, however, local copy no matter what:

cs

...<snip>... cdndebugpath = "http://code.jquery.com/jquery-" + jqueryversion + ".js", cdnpath = "http://code.jquery.com/jquery-" + jqueryversion + ".min.js", ...<snip>... 

output

<script src="scripts/jquery-1.11.2.min.js" type="text/javascript"></script> <script type="text/javascript"> //<![cdata[ (window.jquery)||document.write('<script type="text/javascript" src="scripts/jquery-1.11.2.min.js"><\/script>');//]]> </script> 


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -