Created
December 7, 2012 16:49
-
-
Save underwhelmed/4234575 to your computer and use it in GitHub Desktop.
Convert a relative URL into an Absolute URL in .NET
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 ConvertRelativeUrlToAbsoluteUrl(string relativeUrl) | |
{ | |
if (Request.IsSecureConnection) | |
return string.Format("https://{0}{1}", Request.Url.Host, Page.ResolveUrl(relativeUrl)); | |
else | |
return string.Format("http://{0}{1}", Request.Url.Host, Page.ResolveUrl(relativeUrl)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment