Restsharp 在 WP 7.1 上添加 cookie
我正在尝试使用 RestSharp 将 cookie 添加到请求中,但在 fiddler2 中我没有在请求中看到 cookie,并且服务调用失败。有什么技巧可以将 cookie 添加到 RestRequest 中吗?
RestRequest rq = new RestRequest(LTV.NowNext(), Method.GET);
rc.AddDefaultParameter(LTV.cookie.Key, LTV.cookie.Value, ParameterType.Cookie);
rc.ExecuteAsync<LTV.nowNext>(rq, (response2) =>
{
if (response2.Data == null)
return;
foreach (LTV.channel channel in response2.Data.channels)
this.Items.Add(new ItemViewModel() { LineOne = channel.name, LineTwo = channel.showing[0].content[0].parent.title, LineThree = channel.showing[1].content[0].parent.title });
});
谢谢, 铝
I am trying to add a cookie to a request using RestSharp but in fiddler2 I don't see the cookie in the request and service call is failing. Is there some trick to adding a cookie to the RestRequest?
RestRequest rq = new RestRequest(LTV.NowNext(), Method.GET);
rc.AddDefaultParameter(LTV.cookie.Key, LTV.cookie.Value, ParameterType.Cookie);
rc.ExecuteAsync<LTV.nowNext>(rq, (response2) =>
{
if (response2.Data == null)
return;
foreach (LTV.channel channel in response2.Data.channels)
this.Items.Add(new ItemViewModel() { LineOne = channel.name, LineTwo = channel.showing[0].content[0].parent.title, LineThree = channel.showing[1].content[0].parent.title });
});
Thanks,
Al
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
RestSharp 在 Windows Phone 上向 RestRequest 添加 cookie 时存在错误!
我解决了这个问题,并有一个拉取请求等待它们集成到主分支。
现在,您可以通过使用 AddHeader("Cookie", cookieValuesString) 来解决这个问题...
RestSharp has a bug on Windows Phone when adding cookies to the RestRequest!
I solved the issue and have a pull request waiting for them to integrate to the main branch.
For now, you can overcome this issue by using AddHeader("Cookie", cookieValuesString)...