Ejemplo n.º 1
0
        public QRSNTLMWebClient(string QRSserverURL, Int32 requesttimeout)
        {
            _client = new CookierAwareWebClient {
                Encoding = Encoding.UTF8
            };
            _client.UseDefaultCredentials = true;
            _client.Timeout = requesttimeout;

            //_client.Credentials = CredentialCache.DefaultCredentials;

            _queryStringCollection = new NameValueCollection {
                { "xrfkey", "ABCDEFG123456789" }
            };
            ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); };
            serverURL = QRSserverURL;

            //do a simple first GET to set cookies for subsequent actions (otherwise POST commands wont work)
            try
            {
                string resp = Get("/qrs/about");
            }
            catch (Exception ex)
            {
                throw new Exception("Couldnt connect to the server at " + QRSserverURL + " , check that the Proxy and QRS are running.  Message: " + ex.Message);
            }
        }