AuthBridge.Configuration.UriStringExtensions.ReplaceWithLocalhostWhenRelative C# (CSharp) Method

ReplaceWithLocalhostWhenRelative() public static method

public static ReplaceWithLocalhostWhenRelative ( this uri ) : Uri
uri this
return System.Uri
        public static Uri ReplaceWithLocalhostWhenRelative(this string uri)
        {
            var completeUri = new Uri(uri);
            if (ConfigurationManager.AppSettings.GetBoolSetting("UseRelativeConfiguration"))
            {
                completeUri = new Uri(new Uri(ConfigurationManager.AppSettings["CustomEndpointHost"] ?? "http://localhost/"),
                    new Uri(completeUri.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped))
                        .MakeRelativeUri(completeUri));
            }
            return completeUri;
        }