c# - Visual Studio 2012 SP3 changing link href when using ASP.NET in design view -


i'm using vs 2012 sp3 in have asp.net web site. in "default.aspx" have following link

<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" runat="server" rel="stylesheet" /> 

whenever use design view page inserting new row in table in changes

<link href="http://localhost:50309/netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" runat="server" rel="stylesheet" /> 

which becoming pretty annoying.

does have idea how disable feature ?

i note have productivity power tools 2012 installed web essentials 2012 (but i've disabled them both , still not luck thanks!

update 1: steps reproduce

  • create new .aspx page

  • paste <link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet" /> between head tags.

  • go split view

  • write text between divs

  • the href changes <link href="http://localhost:50309/netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet" /> (port may vary :d)

update 2: microsoft bug report connect link

https://connect.microsoft.com/visualstudio/feedback/details/793557/visual-studio-2012-changing-link-href-when-using-asp-net-in-design-view#details

when using asp.net script bundles, can provide cdn locations script library can found. when add code locally benefit of being able debug against non-minified version while cdn version used when site runs in production.

see following documentation on setting script bundles on asp.net web forms.

basically need add couple of lines global.asax:

void application_start(object sender, eventargs e) {     bundleconfig.registerbundles(bundletable.bundles); } 

and create bundle follows:

public static void registerbundles(bundlecollection bundles) {     //bundles.add(new scriptbundle("~/bundles/jquery").include(     //            "~/scripts/jquery-{version}.js"));      bundles.usecdn = true;   //enable cdn support      //add link jquery on cdn     var jquerycdnpath = "http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.7.1.min.js";      bundles.add(new scriptbundle("~/bundles/jquery",                 jquerycdnpath).include(                 "~/scripts/jquery-{version}.js"));      // code removed clarity. } 

and reference this:

<asp:placeholder runat="server">              <%: scripts.render("~/bundles/modernizr") %>      <%: scripts.render("~/bundles/jquery") %>      <%: scripts.render("~/bundles/jqueryui") %> </asp:placeholder> 

this should please both browser and editor.


you can configure <scriptmanager> automatically fall cdn using following pieces of code:

<asp:scriptmanager runat="server" enablecdn="true">     <scripts>         <asp:scriptreference name="jquery" />         <asp:scriptreference name="jquery.ui.combined" />     </scripts> </asp:scriptmanager> 

and configuration:

var mapping = scriptmanager.scriptresourcemapping; // map jquery definition google cdn mapping.adddefinition("jquery", new scriptresourcedefinition {     path = "~/scripts/jquery-2.0.0.min.js",     debugpath = "~/scripts/jquery-2.0.0.js",     cdnpath = "http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js",     cdndebugpath = "https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.js",     cdnsupportssecureconnection = true,     loadsuccessexpression = "window.jquery" });  // map jquery ui definition google cdn mapping.adddefinition("jquery.ui.combined", new scriptresourcedefinition {     path = "~/scripts/jquery-ui-1.10.2.min.js",     debugpath = "~/scripts/jquery-ui-1.10.2.js",     cdnpath = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js",     cdndebugpath = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.js",     cdnsupportssecureconnection = true,     loadsuccessexpression = "window.jquery && window.jquery.ui && window.jquery.ui.version === '1.10.2'" }); 

read following blog scott hanselman more details.


Comments