Exemplo n.º 1
0
        /// <summary>
        /// Initializes the connection with new WebState and ports required
        /// </summary>
        private void InitializeConnection()
        {
            if (initialized == false)
            {
                try
                {
                    connectionState = new WebState(domainID, collectionID, userID, authType);
                    initialized     = true;
                }
                catch (NeedCredentialsException)
                {
                    authenticated = false;
                }
//				finally
//				{
//                  ssl = this.HostSSL;
                //			}
            }
            if (sslInitialized == false && ssl == true)
            {
                System.UriBuilder uri = new UriBuilder(baseUri);

                if (uri.Scheme == Uri.UriSchemeHttp)
                {
                    uri.Scheme = Uri.UriSchemeHttps;
                    if (uri.Port == 80)
                    {
                        uri.Port = 443;
                    }
                }
                baseUri        = uri.Uri.ToString().TrimEnd('/') + '/';
                sslInitialized = true;
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Clears the connection and resets the webstate
 /// </summary>
 internal void ClearConnection()
 {
     if (key != null)
     {
         lock (connectionTable)
         {
             connectionTable.Remove(key);
         }
     }
     // bug 538046: lot of 401 exceptions during UserMove and hence data loss. After every domain sync/Catalog sync or during web-service
     // ex., server used to remove the cookiehash entry for the domainID, so the connections which were already established earlier were
     // getting 401 status. The removal of cookiehash entry is applicable only for clients as they logout/login from one domain. For
     // servers, it is only one domain, so no login/logout concept for servers.
     if (!Store.IsEnterpriseServer)
     {
         WebState.ResetWebState(domainID);
     }
 }