标准卷曲状从DOTNET访问 [英] standard curl like access from dotnet
本文介绍了标准卷曲状从DOTNET访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有在dotnet的,其转换一个正常的请求字符串到一个适当的请求的任何库?
东西会自动像
client.Headers [Htt的prequestHeader.Authorization]< - 基本+ UN +:+密码;
解决方案
有关的HttpWebRequest
和 Web客户端
,有在证书
属性。你可以这样写:
client.Credentials =新的NetworkCredential(用户名,密码);
不知道有任何类似的使用与的HttpClient
。
Is there any library in dotnet that transforms a 'normal' request string to a proper request?
Something that would automate things like
client.Headers.[HttpRequestHeader.Authorization] <- "Basic " + un + ":" + pw;
解决方案
For HttpWebRequest
and WebClient
, there is the Credentials
property. You can write:
client.Credentials = new NetworkCredential("username", "password");
Don't know of anything similar for use with HttpClient
.
这篇关于标准卷曲状从DOTNET访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文