Skip to content

Instantly share code, notes, and snippets.

@csharpforevermore
Created October 31, 2013 15:31
Show Gist options
  • Save csharpforevermore/7251734 to your computer and use it in GitHub Desktop.
Save csharpforevermore/7251734 to your computer and use it in GitHub Desktop.
C# ASP.NET - get the absolute URL from a relative one
string relativeUrl = "/home";
string returnValue = string.Format("{0}://{1}{2}{3}", current.Scheme, current.Host,
current.Port == 80 ? "" : ":" + current.Port, relativeUrl)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment