public static string GetVanityUri(Guid organizationId, Guid instanceId, string pathAndQuery) { string websiteUrl = string.Empty; if (FrameworkConfiguration.Current.WebApplication.CustomUrl.Enabled) { websiteUrl = GetVanityUrl(organizationId, instanceId); if (string.IsNullOrEmpty(websiteUrl)) { websiteUrl = DefaultVanityUrl; } } else { Guid webSiteId = OrganizationProvider.GetWebsiteIdFromCache(organizationId); if (webSiteId != Guid.Empty) { websiteUrl = WebsiteProvider.GetWebsiteUrlFromCache(webSiteId); } } return(CreateApplicationUri(websiteUrl, pathAndQuery)); }