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

View File

@@ -146,6 +146,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="DateTimeExtensions.cs" />
<Compile Include="Internet\UrlHelper.cs" />
<Compile Include="IO\ProcessAsync.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>

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