Last active
May 28, 2022 16:58
-
-
Save LGM-AdrianHum/c3c8a37b657d6a0c00642ade7a8d6500 to your computer and use it in GitHub Desktop.
Get the base URL of a web api or MVC page.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public string GetBaseUrl() | |
{ | |
var appUrl = HttpRuntime.AppDomainAppVirtualPath; | |
return $"{Request?.Url.Scheme}://{Request?.Url.Authority}/{appUrl.TrimStart('/')}"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Used in the API documentation pages of ID4ME Search 2 website to provide live examples.