但是在-6ren">
gpt4 book ai didi

asp.net-mvc - 在 ASP.net MVC 2.0 中使用 Url.Content

转载 作者:行者123 更新时间:2023-12-04 10:57:58 25 4
gpt4 key购买 nike

我已经看到了很多使用 Url.Content 来引用 javascript,在 MVC 2 中形成 MasterPages 的例子。

    <script src="<%: Url.Content("~/Scripts/jquery-1.4.1.min.js") %>" type="text/javascript"></script>

但是在运行时我失败了,

Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.



编译器错误消息:CS0103:当前上下文中不存在名称“Url”。

我还没有找到在哪里声明 Url 命名空间,是否应该使用其他程序集?

VS2010、IIS 7、ASP.net MVC 2.0

最佳答案

确保您的母版页继承 System.Web.Mvc.ViewMasterPage

关于asp.net-mvc - 在 ASP.net MVC 2.0 中使用 Url.Content,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3912508/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com