mirror of
https://github.com/ckaczor/Common.git
synced 2026-01-13 17:22:40 -05:00
Add GetAbsoluteUrlString
This commit is contained in:
@@ -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
15
Internet/UrlHelper.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user