授权HttpClient请求
本文关键字:请求 HttpClient 授权 | 更新日期: 2023-09-27 18:08:36
我正在尝试访问twitter用户的followers
页面,但内容不可用于来宾。
using (var res = await http.GetAsync("http://www.twitter.com/" + handle + "/followers"))
{
followers = new List<string>();
...
// res returns a login page
有什么简单的方法来授权我的请求在ASP.NET?我能否以某种方式使用向我的ASP发送请求的客户端的cookie ?网络页面?
好吧,这是一个愚蠢的想法。还有别的办法管用吗?
我是这样做的:
var authenticationCookie = HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];
,然后使用authenticationCookie代表用户调用API。