From b327c474f3dd38773e817e9f2368a916933c534f Mon Sep 17 00:00:00 2001 From: Chris Kaczor Date: Tue, 29 Mar 2016 20:04:27 -0400 Subject: [PATCH] Add GetAbsoluteUrlString --- Common.csproj | 1 + Internet/UrlHelper.cs | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 Internet/UrlHelper.cs diff --git a/Common.csproj b/Common.csproj index fccd0ff..a8bb9dc 100644 --- a/Common.csproj +++ b/Common.csproj @@ -146,6 +146,7 @@ + True diff --git a/Internet/UrlHelper.cs b/Internet/UrlHelper.cs new file mode 100644 index 0000000..0aeaa46 --- /dev/null +++ b/Internet/UrlHelper.cs @@ -0,0 +1,15 @@ +using System; + +namespace Common.Internet +{ + public static class UrlHelper + { + public static string GetAbsoluteUrlString(string baseUrl, string url) + { + var uri = new Uri(url, UriKind.RelativeOrAbsolute); + if (!uri.IsAbsoluteUri) + uri = new Uri(new Uri(baseUrl), uri); + return uri.ToString(); + } + } +}