//ported from IISOOB\projects\ui\wm\Deployment\Data\Profiles\PublishProfile.cs private string ConstructServiceUrlForDeployThruWMSVC(string serviceUrl) { const string https = "https://"; const string http = "http://"; const string msddepaxd = "msdeploy.axd"; System.UriBuilder serviceUriBuilder = null; // We want to try adding https:// if there is no schema. However abc:123 is parsed as a schema=abc and path=123 // so the goal is to isolate this case and add the https:// but allow for http if the user chooses to // since we do not allow for any schema other than http or https, it's safe to assume we can add it if none exist try { if (!(serviceUrl.StartsWith(http, StringComparison.OrdinalIgnoreCase) || serviceUrl.StartsWith(https, StringComparison.OrdinalIgnoreCase))) { serviceUrl = string.Concat(https, serviceUrl.TrimStart()); } serviceUriBuilder = new UriBuilder(serviceUrl); } catch (NullReferenceException) { return(string.Empty); } catch (ArgumentNullException) { return(string.Empty); } catch (UriFormatException) { return(serviceUrl); } // if the user did not explicitly defined a port if (serviceUrl.IndexOf(":" + serviceUriBuilder.Port.ToString(CultureInfo.InvariantCulture), StringComparison.OrdinalIgnoreCase) == -1) { serviceUriBuilder.Port = 8172; } // user did not explicitly set a path if (string.IsNullOrEmpty(serviceUriBuilder.Path) || serviceUriBuilder.Path.Equals("/", StringComparison.OrdinalIgnoreCase)) { serviceUriBuilder.Path = msddepaxd; } // user did not explicityly set the scheme if (serviceUrl.IndexOf(serviceUriBuilder.Scheme, StringComparison.OrdinalIgnoreCase) == -1) { serviceUriBuilder.Scheme = https; } if (string.IsNullOrEmpty(serviceUriBuilder.Query)) { string[] fragments = SiteName.Trim().Split(new char[] { '/', '\\' }); serviceUriBuilder.Query = "site=" + fragments[0]; } return(serviceUriBuilder.Uri.AbsoluteUri); }