RestResponseCookie is not interchangeable with System.Net.Cookie
See original GitHub issueExpected Behavior
Consider this code
var client = new RestClient("https://example.com/api");
var loginRequest = new RestRequest("Login", Method.POST);
var result = client.Execute(loginRequest ); // has a Set-Cookie: SessionID blablabla
//add the session cookie to the client for all further requests
foreach(var cookie in result.Cookies){
client.CookieContainer.Add(cookie) //<-- Type Error
}
Actual Behavior
Error: cannot convert "RestSharp.RestResponseCookie" to "System.Net.Cookie"
Is there a good reason to have a RestResponseCookie (which looks like copied from System.Net.Cookie, all fields are the same) and use it over the standard class? Otherwise this looks like a minor design flaw
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:29 (4 by maintainers)
Top Results From Across the Web
Fixing obsolete warning of RestResponseCookie
I have a project that is using RestResponseCookie, it is showing me a warning ... The only way to fix the warning is...
Read more >RestSharp Next (v107+)
It's because cookies are added to the HttpMessageHandler cookie container, which is not accessible inside the request class. var request = new RestRequest()...
Read more >Saving Cookies from RestResponse or Passing Session IDs
I have written a c# code using RestSharp library to interact with RightScale API. The code works fine with one set of username...
Read more >Attach file to post using C# RestSharp and Drupal Services
I have figured it out this way, sorry for late posting the answer: // FIRST LOGIN var client = new RestClient("http://.
Read more >C# (CSharp) RestSharp RestClient.Execute Examples
AddBody(template); var response = client.Execute(request) as RestResponse; if (response.StatusCode.Equals(System.Net.HttpStatusCode.Created)) Response.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
damn bot should be sent to /dev/null
I removed
HttpCookie
entirely in v107. However, cookies were always accessible directly via the cookie container, you should always use one as you’d do withHttpClient
.The pre-release package is out there, feel free to test it. If you get any issues with cookies, please open another issue.