I'm using VS 2012 SP3 in which i have an ASP.NET web site. In my "Default.aspx" i have the following link
我在使用VS 2012 SP3,我有一个ASP。网的网站。在我的“默认。我有以下链接
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" runat="server" rel="stylesheet" />
Whenever i use the design view to for my page like inserting a new row in table in changes it to
每当我为我的页面使用design视图时,比如在表中插入一个新的行来更改它
<link href="http://localhost:50309/netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" runat="server" rel="stylesheet" />
Which is becoming pretty annoying.
这很烦人。
Does anyone have any idea about how to disable this feature ?
有人知道如何禁用这个功能吗?
I would also like to note that I have Productivity Power Tools 2012 installed Web Essentials 2012 (but i've disabled them both and still not luck Thanks!
我还想指出,2012年我已经安装了生产力工具,2012年安装了Web Essentials(但我已经禁用了它们,而且还不太幸运,谢谢!)
Update 1: Steps to reproduce
更新1:复制的步骤
-
Create a new .aspx page
创建一个新的.aspx页面
-
Paste
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet" />
between the head tags.粘贴 在头标签之间。
-
Go to split view
去拆分视图
-
Write some text between the divs
在女主角之间写一些文字
-
The href changes to
<link href="http://localhost:50309/netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet" />
(port may vary :D)href改变为 (端口可能不同:D)
Update 2: Microsoft Bug Report Connect Link
更新2:microsoftbug报告连接链接。
https://connect.microsoft.com/visualstudio/feedback/details/793557/visual工作室- 2012变化-链接- href当使用asp -净- -设计-视图#细节
2 个解决方案
#1
3
When using the ASP.NET Script Bundles, you can provide the CDN locations where your script library can be found. When you also add the code locally you get the benefit of being able to debug against the non-minified version while the CDN version will be used when the site runs in production.
当使用ASP。NET脚本包,您可以提供可以找到脚本库的CDN位置。当您还在本地添加代码时,您将获得对非小型化版本进行调试的好处,而当站点在生产环境中运行时,将使用CDN版本。
See the following documentation on setting up script bundles on ASP.NET Web Forms.
请参阅以下关于在ASP上设置脚本包的文档。净Web表单。
basically you need to add a couple of lines to the Global.asax:
基本上你需要在全球增加几行。
void Application_Start(object sender, EventArgs e)
{
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
And then create your bundle as 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 to jquery on the 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 for clarity.
}
And reference it like this:
引用如下:
<asp:PlaceHolder runat="server">
<%: Scripts.Render("~/bundles/modernizr") %>
<%: Scripts.Render("~/bundles/jquery") %>
<%: Scripts.Render("~/bundles/jqueryui") %>
</asp:PlaceHolder>
This should please both the browser and the editor.
这应该会让浏览器和编辑器都满意。
You can also configure the <scriptmanager>
to automatically fall back to the CDN using the 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 this configuration:
这配置:
var mapping = ScriptManager.ScriptResourceMapping;
// Map jquery definition to the 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 to the 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 the following blog by Scott Hanselman for more details.
请阅读Scott Hanselman的博客,了解更多细节。
#2
2
The VS designer is picky about URI formats in a link tag, and it will "fix" any href that it does not approve of. The result is not always helpful.
VS设计器对链接标记中的URI格式很挑剔,它将“修复”它不赞成的任何href。结果并不总是有益的。
In your case, the issue is that your href is missing a scheme name. VS should stop rewriting your href if you change your link tag like this:
在您的例子中,问题是您的href缺少一个scheme名称。VS应该停止重写你的href,如果你像这样改变你的链接标签:
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet" type="text/css" />
Side Note: After you fix the href, the designer may complain that it can't edit the style sheet. I don't know why it does that with this particular file, and I have not seen it do this with other CSS. Just ignore the warning, and the style sheet should be applied correctly.
附加说明:修复href之后,设计人员可能会抱怨它不能编辑样式表。我不知道为什么它会对这个文件这样做,我也没见过它对其他CSS这样做。只要忽略警告,样式表就应该正确地应用。
#1
3
When using the ASP.NET Script Bundles, you can provide the CDN locations where your script library can be found. When you also add the code locally you get the benefit of being able to debug against the non-minified version while the CDN version will be used when the site runs in production.
当使用ASP。NET脚本包,您可以提供可以找到脚本库的CDN位置。当您还在本地添加代码时,您将获得对非小型化版本进行调试的好处,而当站点在生产环境中运行时,将使用CDN版本。
See the following documentation on setting up script bundles on ASP.NET Web Forms.
请参阅以下关于在ASP上设置脚本包的文档。净Web表单。
basically you need to add a couple of lines to the Global.asax:
基本上你需要在全球增加几行。
void Application_Start(object sender, EventArgs e)
{
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
And then create your bundle as 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 to jquery on the 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 for clarity.
}
And reference it like this:
引用如下:
<asp:PlaceHolder runat="server">
<%: Scripts.Render("~/bundles/modernizr") %>
<%: Scripts.Render("~/bundles/jquery") %>
<%: Scripts.Render("~/bundles/jqueryui") %>
</asp:PlaceHolder>
This should please both the browser and the editor.
这应该会让浏览器和编辑器都满意。
You can also configure the <scriptmanager>
to automatically fall back to the CDN using the 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 this configuration:
这配置:
var mapping = ScriptManager.ScriptResourceMapping;
// Map jquery definition to the 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 to the 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 the following blog by Scott Hanselman for more details.
请阅读Scott Hanselman的博客,了解更多细节。
#2
2
The VS designer is picky about URI formats in a link tag, and it will "fix" any href that it does not approve of. The result is not always helpful.
VS设计器对链接标记中的URI格式很挑剔,它将“修复”它不赞成的任何href。结果并不总是有益的。
In your case, the issue is that your href is missing a scheme name. VS should stop rewriting your href if you change your link tag like this:
在您的例子中,问题是您的href缺少一个scheme名称。VS应该停止重写你的href,如果你像这样改变你的链接标签:
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet" type="text/css" />
Side Note: After you fix the href, the designer may complain that it can't edit the style sheet. I don't know why it does that with this particular file, and I have not seen it do this with other CSS. Just ignore the warning, and the style sheet should be applied correctly.
附加说明:修复href之后,设计人员可能会抱怨它不能编辑样式表。我不知道为什么它会对这个文件这样做,我也没见过它对其他CSS这样做。只要忽略警告,样式表就应该正确地应用。