Example #1
0
        private void IssueTrackerLogin(string username, string password)
        {
            try
            {
                WebClientEx webClient = new WebClientEx();
                webClient.Headers.Add("user-agent", userAgent);
                webClient.Method = "POST";

                webClient.QueryString.Add("user_name", username);
                webClient.QueryString.Add("password", password);
                webClient.QueryString.Add("remember_login", "on"); // Always remember login.

                webClient.UploadValuesCompleted += new UploadValuesCompletedEventHandler(IssueTrackerLogin_Completed);
                webClient.UploadValuesAsync(new Uri(issueTrackerUrl + "?do=nakedauth"), webClient.QueryString);
            }
            catch (WebException)
            {
                ConnectionError();
            }
        }
Example #2
0
        public void WebLogin(string url, string username, string pwd)
        {
            string source = string.Empty;

            try
            {
                ServicePointManager.SecurityProtocol       = (SecurityProtocolType)3072; //TLS 1.2
                ServicePointManager.DefaultConnectionLimit = 256;

                WebClientEx ws = new WebClientEx();

                var reqParams = new System.Collections.Specialized.NameValueCollection();
                reqParams.Add("account", username);
                reqParams.Add("password", pwd);

                ws.UploadValuesCompleted += Ws_login_completed;
                ws.UploadValuesAsync(new Uri(url), "POST", reqParams);
            }
            catch (Exception ex)
            {
                Utils.SaveLog(ex.Message, ex);
            }
        }