How can I get the baseurl of site?

后端 未结 12 1661
借酒劲吻你
借酒劲吻你 2020-11-30 17:43

I want to write a little helper method which returns the base URL of the site. This is what I came up with:

public static string GetSiteUrl()
{
    string ur         


        
12条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-30 17:45

    This is a much more fool proof method.

    VirtualPathUtility.ToAbsolute("~/");
    

提交回复
热议问题