| 
Groups: Administration
Joined: 11/3/2005(UTC)
 Posts: 2,253
 
 Thanks: 28 timesWas thanked: 60 time(s) in 59 post(s)
 
 | 
            
	      
                Hi! You may also consider using following not-yet-document method of the Metabase class: Code:
/// (summary)
/// Generates port-agnostic link to an application via UWS Redirector.
/// (/summary)
/// (param name="appID")(/param)
/// (param name="host")
/// Optional. Host name or IP address to be used in the URL pointing to the UWS Recirector application. 
/// If null, default host will be used. If set to "*IOS*", host will be in the format of "machinename.local" or "machinename", 
/// depending on whether host machine is a member of a domain.
/// (/param)
/// (param name="optionalPathAndQueryString")Optional. A part to be appended to the redirection URL, 
/// in case start page is different from web app's default document.(/param)
/// (param name="portOrder")Optional. Lists port number preference order. 
/// Should be used when multiple non-80 and non-443 is used as listen addresses.(/param)
/// (returns)(/returns)
public static string CreateAppRedirectLink(Guid appID, string host = null, string optionalPathAndQueryString = null, params ushort[] portOrder)
{
    const string autoIOShost = "*IOS*";
    if (string.IsNullOrEmpty(host) || host == autoIOShost)
        host = GetDefaultHost(forIOS: host == autoIOShost);
    WebAppConfigEntry uwsRedirector = Metabase.FindApplication(AppPoolRegistrationHelper.LegacyCassiniExplorerAppID);
    string[] urls = uwsRedirector.GetBrowseUrls(host);
    StringBuilder url = new StringBuilder();
    url.Append(urls[0]);
    url.AppendFormat("GoToApplication.aspx/{0}", appID.ToString().ToUpper());
    if (portOrder != null)
    {
        foreach (ushort port in portOrder)
            url.AppendFormat(",{0}", port);
    }
    url.Append("/");
    if (!string.IsNullOrEmpty(optionalPathAndQueryString))
        url.Append(optionalPathAndQueryString.TrimStart('/'));
    return url.ToString();
}
 Best regards, UltiDev Team. Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products. | 
    | 
            1 user thanked Ultidev Team for this useful post. |  |