Get absolute path of file on content

前端 未结 5 619
轮回少年
轮回少年 2020-12-15 03:58

Is there any easy (built in) way in an asp.net mvc view to get the absolute path of a file in the content folder?

At the moment I\'m using

@Url.Cont         


        
5条回答
  •  無奈伤痛
    2020-12-15 04:49

    new Uri(Request.Url, Url.Content("~/Content/images/logo.png"))
    

    this calls the .ToString() of Uri. You can also put Uri in a variable and call .AbsoluteUri.

提交回复
热议问题