Can't get site root url in asp mvc

前端 未结 5 1213
伪装坚强ぢ
伪装坚强ぢ 2020-12-30 21:13

I need to get site root url in razor page in javascript code:

...
var siteRootUrl = \'@Url.Content(\"~\")\';
...

But all I get from this is

5条回答
  •  情歌与酒
    2020-12-30 21:20

    Easiest way I know to get AbsoluteUri would be

    @Url.Action("", null, null, "http")
    

提交回复
热议问题