static void Main(string[] args) { ParseArguments(args); if (Url.Length == 0 || Username.Length == 0 || Password.Length == 0) { return; } // Create a WebClient that keeps cookies stored and uses a // client certificate to authenticate the requests. EnhancedWebClient client = new EnhancedWebClient(Cert, CertPw); // Create a CitrixConnector that can login and authenticate CitrixConnector connector = new CitrixConnector(client, Url); connector.LoginUser(Username, Password); connector.AuthenticateRequests(); if (AppName.Length != 0) { // load the ica file String icaPath = connector.GetIcaFile(AppName); // and launch the IcaClient with that file. LaunchIcaClient(icaPath); } }
public CitrixConnector(EnhancedWebClient client, String baseUrl) { this.client = client; this.baseUrl = baseUrl; }
/// <summary> /// Extracts the authentication method url from response headers of a /// web Client. Should be called just after a request that failed. /// </summary> /// <param name="Client"></param> /// <returns></returns> private String GetAuthenticationUrlFromHeader(EnhancedWebClient Client) { String header = Client.GetResponseHeader("CitrixWebReceiver-Authenticate"); return(GetAuthenticationUrlFromHeader(header)); }