【发布时间】:2023-04-05 23:21:02
【问题描述】:
我正在寻找一个 WebForms 项目中的一个奇怪错误,在该项目中我找不到第二个 jQuery 参考的来源。
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-1.10.2.min.js",
//additional entries omitted
));
现在这个包在我的母版页文件中被调用:
<asp:PlaceHolder runat="server">
<%: Scripts.Render("~/bundles/jquery") %>
<%: Styles.Render("...") %>
</asp:PlaceHolder>
只要用户停留在网页的根文件夹 (www.domain.com/page),evertyhing 就可以正常工作。不幸的是,当用户被重定向到位于子文件夹 (www.domain.com/subfolder/someotherpage) 中的 aspx 页面时,会出现以下错误:
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:53078/Scripts/jquery-1.10.2.js
我已经搜索了整个解决方案,但找不到它的来源。
查看渲染的源代码我看到了这个:
<body>
<script src="../Scripts/jquery-1.10.2.js" type="text/javascript"></script>
</body>
现在这看起来不像由捆绑渲染的脚本标签,它们位于头部。给定脚本标签的位置,这应该来自母版页文件,但我不能指望它:
<head runat="server">
<asp:PlaceHolder runat="server">
<%: Scripts.Render("~/bundles/jquery") %>
<%: Styles.Render("~/bundles/Stylesheets") %>
</asp:PlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<telerik:RadScriptManager runat="server" EnableEmbeddedjQuery="false">
<Scripts>
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryExternal.js" />
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryPlugins.js" />
</Scripts>
</telerik:RadScriptManager>
<%: Scripts.Render("~/bundles/UiEffects") %>
</body>
在您提出建议之前:我已尝试将 RadScriptManager 替换为原版 asp:ScriptManager,但无济于事。
是否可以确定脚本引用源自 asp.net Web 项目中的哪一行代码,以便我可以消除它?
【问题讨论】:
标签: asp.net telerik scriptmanager asp.net-bundling