旧的jquery版本自动包含在asp.net webforms中 [英] old jquery version is automatically included in asp.net webforms
问题描述
我有一个asp.net c#webforms项目。在div中的输出htmlaspNetHidden是指向
I have a asp.net c# webforms project. In the output html in the div "aspNetHidden" is a link to
<script src="/Scripts/jquery-1.8.2.js" type="text/javascript"></script>
我无法弄清楚如何删除此代码。它不在母版页文件中,我似乎无法在任何地方找到它。我想使用更新版本的jquery,并将引用放在页面底部。
I cannot figure out how to remove this code. It's not in the master page file, and I can't seem to find it anywhere. I would like to use a newer version of jquery, and place the reference at the bottom of the page instead.
我怀疑它来自一个已安装的NuGet包,但是我无法弄清楚哪一个,我认为我需要它们。
I suspect it's from one of the installed NuGet packages, but I can't figure out which one, and I think i need them all.
编辑:
如果我创建一个新项目并选择ASP.NET Web表单应用程序,jquery链接就在那里。我正在使用2012年的visual studio express。
If i create a new project and select ASP.NET Web Forms Application, the jquery link is there. I'm using visual studio express 2012.
编辑2:找到一个解决方案 - 作为其他有类似问题的人的答案发布。
EDIT 2: Found a solution - posted as an answer for others with similar problem to see.
推荐答案
我找到了解决方案。它由scriptmanager添加,但可以通过在global.asax中添加以下内容来覆盖它。我不知道我是否可以完全禁用它,但这适用于我。
I found a solution. It's added by the scriptmanager, but can be overridden by adding the following in the global.asax. I don't know if I can disable it completely, but this works for me.
string str = "1.10.2";
ScriptManager.ScriptResourceMapping.AddDefinition("jquery", new ScriptResourceDefinition
{
Path = "~/js/jquery-" + str + ".min.js",
DebugPath = "~/js/jquery-" + str + ".min.js",
CdnPath = "http://code.jquery.com/jquery-" + str + ".min.js",
CdnDebugPath = "http://code.jquery.com/jquery-" + str + ".min.js",
CdnSupportsSecureConnection = true
});
这篇关于旧的jquery版本自动包含在asp.net webforms中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!