0
我遇到問題,並認爲我可能會錯過某些與RestSharp。 我正在授權並取回一個cookie就好了......看下面。但是當我打電話來獲取數據時,它會返回未授權的狀態。它在Postman中工作得很好,但不在下面的代碼中。我正在使用控制檯應用程序,並嘗試通過AddHeader,AddCookie發送cookie,並將其作爲參數。 responseLogin包含正確的cookie。任何幫助都會很棒。RestSharp返回未授權
Dim clientLogin = New RestClient("http://[URI to Authorize]............")
Dim requestLogin = New RestRequest(Method.POST)
requestLogin.AddParameter("application/x-www-form-urlencoded", "[Username and password here.....]", ParameterType.RequestBody)
Dim responseLogin As IRestResponse = clientLogin.Execute(requestLogin)
Dim client = New RestClient("http://[URI to get data]............")
Dim request = New RestRequest(Method.GET)
request.AddHeader("Cookie", responseLogin.Cookies(0).Value.ToString)
request.AddHeader("Accept", "application/json")
Dim response As IRestResponse = client.Execute(request)