Tilde Slash Paths Not Working in MVC 4

前端 未结 8 484
逝去的感伤
逝去的感伤 2021-01-12 01:10

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

8条回答
  •  鱼传尺愫
    2021-01-12 02:03

    This could be as a result of a bug in Razor V2, where an apostrophe / single quote in an HTML comment breaks resolution of ~ paths.

    The workaround is to use Razor comments instead of HTML comments. I.e., replace with @* Here's your comment *@.

    Sorry this is a long shot, as I've no idea if you have HTML comments, let alone ones containing single quotes.

提交回复
热议问题