<PackageReference Include="Relativity.Server.Import.SDK" Version="2.9.2" />

UrlHelper

static class UrlHelper
Defines static methods to perform common URL operations.
using System; namespace Relativity.DataExchange { internal static class UrlHelper { public static string GetBaseUrl(string url) { if (!Uri.IsWellFormedUriString(url, UriKind.Absolute)) throw new UriFormatException("The base URL cannot be retrieved from " + url + " because it's not well-formed."); return new Uri(new Uri(url).GetLeftPart(UriPartial.Authority)).ToString(); } public static string GetBaseUrlAndCombine(string baseUrl, string relativePath) { return Combine(GetBaseUrl(baseUrl), relativePath); } public static string Combine(string absoluteUrl, string relativePath) { if (!Uri.IsWellFormedUriString(absoluteUrl, UriKind.Absolute)) throw new UriFormatException("The URL " + absoluteUrl + " cannot be combined with '" + relativePath + "' because it's not well-formed."); string text = new Uri(new Uri(absoluteUrl), relativePath).ToString(); if (!text.EndsWith("/", StringComparison.OrdinalIgnoreCase)) text += "/"; return text; } } }