How can I get the baseurl of site?

后端 未结 12 1658
借酒劲吻你
借酒劲吻你 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 18:07

    I'm using following code from Application_Start

    String baseUrl = Path.GetDirectoryName(HttpContext.Current.Request.Url.OriginalString);

提交回复
热议问题