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

前端之家收集整理的这篇文章主要介绍了asp.net-mvc – 在ASP.net MVC 2.0中使用Url.Content前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我看过很多使用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
原文链接:https://www.f2er.com/aspnet/247730.html

猜你在找的asp.Net相关文章