波浪号斜线路径在MVC 4不工作 [英] Tilde Slash Paths Not Working in MVC 4

查看:134
本文介绍了波浪号斜线路径在MVC 4不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于我理解,一个普通的醇'〜/ foo的路径应该像@ Url.Content工作(〜/)在MVC 4。但是,我想做到这一点,越来越多破碎的路径 - 中波浪仍然存在,当HTML输出。

As I understand it, a plain ol' "~/foo" path is supposed to work like @Url.Content("~/") in MVC 4. However, I'm trying to do this and getting many broken paths -- the tilde is still there when the HTML is output.

因此​​,举例来说,我在/Views/Shared/_Layout.cshtml这个路径:

So, for example, I have this path in /Views/Shared/_Layout.cshtml:

<link href="~/Content/Site.css" rel="stylesheet" type="text/css" />

和HTML交付看起来是这样的:

And the HTML delivered looks like this:

<link href="~/Content/Site.css" rel="stylesheet" type="text/css" />

我是pretty相信我有这个运行作为一个MVC 4项目了。下面的东西是在web.config:

I'm pretty sure I have this running as an MVC 4 project, too. The following stuff's in the web.config:

<compilation debug="true" targetFramework="4.0">
  <assemblies>
    <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
  </assemblies>
</compilation>

...在这一点上,我不知道该怎么寻找下一个。有什么建议?

...and at this point, I'm not sure what to look for next. Any suggestions?

推荐答案

使用独立的安装程序重新安装MVC 4(RC)的解决了这个问题对我来说nofollow的>在这里。我还是不明白是什么原因造成的问题,但我可以忍受的。

Reinstalling MVC 4 (RC) using the standalone installer here solved this problem for me. I still don't understand what caused the problem, but I can live with that.

这篇关于波浪号斜线路径在MVC 4不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆