Add GetAbsoluteUrlString

This commit is contained in:
2016-03-29 20:04:27 -04:00
parent f375141d68
commit b327c474f3
2 changed files with 16 additions and 0 deletions

15
Internet/UrlHelper.cs Normal file
View File

@@ -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();
}
}
}