Tilde Slash Paths Not Working in MVC 4

前端 未结 8 540
逝去的感伤
逝去的感伤 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条回答
  •  梦毁少年i
    2021-01-12 01:42

    I had this problem when I cut and paste some example code into a view. Turned out I had the wrong type of tilde!

    @{
    Layout = "∼/Views/_BasicLayout.cshtml";
    }
    

    vs

    @{
    Layout = "~/Views/_BasicLayout.cshtml";
    }
    

    Subtly different - sod to find

提交回复
热议问题