加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

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

发布时间:2020-12-16 04:15:59 所属栏目:asp.Net 来源:网络整理
导读:我看过很多使用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 du
我看过很多使用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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读