Ejemplo n.º 1
0
 public ApiClient(string host, string apiRoot, UriScheme uriScheme)
 {
     if (string.IsNullOrEmpty(host))
     {
         throw new ArgumentException("Empty host.", "host");
     }
     if (apiRoot == null)
     {
         throw new ArgumentNullException("apiRoot");
     }
     Host = host;
     ApiRoot = apiRoot.TrimStart('~').Trim('/');
     UriScheme = uriScheme;
 }
Ejemplo n.º 2
0
        public ApiClient(string host, string apiRoot, UriScheme uriScheme)
        {
            if (apiRoot.Length > 0 && apiRoot[0] == '~')
            {
                if (HttpContext.Current != null && HttpContext.Current.Request.Cookies.Get("asc_auth_key") != null)
                    apiRoot = VirtualPathUtility.ToAbsolute(apiRoot);
                else
                    apiRoot = apiRoot.TrimStart('~');
            }

            Host = host;
            ApiRoot = apiRoot.Trim('/');
            UriScheme = uriScheme;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// <c>BasicClient</c> constructor.
 /// </summary>
 /// <param name="host">The hostname of the InSites server.</param>
 /// <param name="username">A username associated with an InSites login.</param>
 /// <param name="password">The password of the specified user.</param>
 public APIClient(UriScheme scheme, string host, string username, string password, int port)
 {
     Byte[] byteAuthorizationToken = System.Text.Encoding.ASCII.GetBytes(username + ":" + password);
     this.authHeaderValue = Convert.ToBase64String(byteAuthorizationToken);
     this.hostIP = host;
     this.scheme = scheme.ToString().ToLower();
     this.sessionCookie = string.Empty;
 }