在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
public void SetBasicAuthHeader(WebRequest request, String userName, String userPassword) { string authInfo = userName + ":" + userPassword; authInfo = Convert.ToBase64String(Encoding.Default.GetBytes(authInfo)); request.Headers["Authorization"] = "Basic " + authInfo; }
public void FetchTasks(string url, string accessToken) { var httpWebRequest = HttpWebRequest.CreateHttp(url); request.Headers.Add("Authorization", "Bearer "+accessToken); httpWebRequest.BeginGetResponse(new AsyncCallback(FinishedWebRequest), httpWebRequest); }
|
请发表评论