c# - aspnet EnableCDN feature configuration -
i'm trying implement scriptmanager enablecdn feature. until , after research have code.
in global.asax file
void application_start(object sender, eventargs e) { // code runs on application startup // map simple name path scriptmanager.scriptresourcemapping.adddefinition("jquery", new scriptresourcedefinition { path = "~/js/libs/jquery/jquery.js", debugpath = "~/js/libs/jquery/jquery.js" , cdnpath = "http://ajax.microsoft.com/ajax/jquery/jquery-1.9.1.min.js", cdndebugpath = "http://ajax.microsoft.com/ajax/jquery/jquery-1.9.1.min.js" }); scriptmanager.scriptresourcemapping.adddefinition("twitter", new scriptresourcedefinition { path = "js/libs/bootstrap/bootstrap.min.js", debugpath = "~/js/libs/bootstrap/bootstrap.min.js" , cdnpath = "http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js", cdndebugpath = "http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js" }); } in scriptmanager :
<asp:scriptmanager id="sm" runat="server" loadscriptsbeforeui="true" enablecdn="true" enablecdnfallback="true"> as can see set path cdn's , paths local files. when test without internet connection dosen't fallback local files. (still try load cdn ) i'm misunderstand concept of feature?
well, after searching on web found article explains concept well. shows configuration use , how use , without aspnet 4.5.
i hope helps out there
Comments
Post a Comment