.net Post数据到指定服务器
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 |
public
string GetKeywordState( string
keywords) { string
url = Request.Url.Host; keywords = keywords.Length > 0 ? keywords.Substring(0, keywords.Length - 1) : "" ; HttpClient client = new
HttpClient(); client.BaseAddress = new
Uri(Tools.ConfigManager.GetString( "GetKeywordStateHostUrl" , "ShowWeb5" )); client.DefaultRequestHeaders.Add( "Authorization" , "Basic "
+ Tools.Crypto.Encrypt(Tools.ConfigManager.GetString( "ApiAuthorization" , "ShowWeb5" ))); HttpResponseMessage response = client.PostAsJsonAsync(Tools.ConfigManager.GetString( "GetKeywordStateFullUrl" , "ShowWeb5" ), new
{ Url = url, Keywords = keywords }).Result; if
(response.IsSuccessStatusCode) { var
ss = response.Content.ReadAsStringAsync().Result; Console.WriteLine(ss); } return
"" ; } |
new
{
Url = url, Keywords = keywords } !
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。