How can I get the baseurl of site?

Try this:

string baseUrl = Request.Url.Scheme + "://" + Request.Url.Authority + 
    Request.ApplicationPath.TrimEnd("https://stackoverflow.com/") + "https://stackoverflow.com/";

Leave a Comment