开发者

Restsharp on WP 7.1 adding cookies

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, 开发者_如何学Python(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


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)...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜