mirror of
https://github.com/ckaczor/Common.git
synced 2026-01-13 17:22:40 -05:00
Add GetAbsoluteUrlString
This commit is contained in:
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