【发布时间】:2011-02-16 00:19:26
【问题描述】:
更新此问题在 ASP.NET MVC 的发布位中不存在
我有一个 ASP.NET MVC RC 应用程序,它在从 http://localhost:9002/ 运行的调试器下运行良好,但是当我将它发布到 http://localhost/Zot/ 时,对 Url.Content 的调用返回不正确的值。
我有类似的脚本标签
<script src="<%= Url.Content("~/Scripts/util.js") %>" ...
在已发布的网站中,这会产生:
<script src="Zot/Scripts/util.js" ...
代替
<script src="/Zot/Scripts/util.js" ...
或
<script src="Scripts/util.js" ...
我有样式表标签,例如:
<link href="~/Content/Site.css" runat="server" ...
产生正确的东西:
<link href="Content/Site.css" ...
关于为什么 Url.Content 失败的任何建议。我显然不能在<script> 标签上加上runat="server"。
【问题讨论】:
标签: asp.net asp.net-mvc