상속: System.Net.WebClient
예제 #1
0
        private string UploadDataToBugzilla(string query)
        {
            var encoding  = Encoding.UTF8;
            var webClient = new TpWebClient(new PluginProfileErrorCollection())
            {
                Encoding = encoding
            };

            webClient.Headers.Add(HttpRequestHeader.ContentType, "application/x-www-form-urlencoded");

            if (!string.IsNullOrEmpty(_profile.Login) && !string.IsNullOrEmpty(_profile.Password))
            {
                query += string.Format("&Bugzilla_login={0}&Bugzilla_password={1}", _profile.Login, _profile.Password);
            }

            var bret = webClient.UploadData(string.Format("{0}/tp2.cgi", Url), "POST", encoding.GetBytes(query));

            var content = encoding.GetString(bret);

            return(content);
        }
		private string UploadDataToBugzilla(string query)
		{
			var encoding = Encoding.UTF8;
			var webClient = new TpWebClient { Encoding = encoding };
			webClient.Headers.Add(HttpRequestHeader.ContentType, "application/x-www-form-urlencoded");

			if (!string.IsNullOrEmpty(_profile.Login) && !string.IsNullOrEmpty(_profile.Password))
			{
				query += string.Format("&Bugzilla_login={0}&Bugzilla_password={1}", _profile.Login, _profile.Password);
			}

			var bret = webClient.UploadData(string.Format("{0}/tp2.cgi", Url), "POST", encoding.GetBytes(query));

			var content = encoding.GetString(bret);

			return content;
		}
		private string UploadDataToBugzilla(string query)
		{
			var encoding = Encoding.UTF8;
			var webClient = new TpWebClient(new PluginProfileErrorCollection()) { Encoding = encoding };
			webClient.Headers.Add(HttpRequestHeader.ContentType, "application/x-www-form-urlencoded");

			if (!string.IsNullOrEmpty(_profile.Login) && !string.IsNullOrEmpty(_profile.Password))
			{
				query += $"&Bugzilla_login={_profile.Login}&Bugzilla_password={_profile.Password}";
			}

			var bret = webClient.UploadData($"{Url}/tp2.cgi", "POST", encoding.GetBytes(query));

			var content = encoding.GetString(bret);

			return content;
		}