4

我正在尝试使用 RestSharp 将 cookie 添加到请求中,但在 fiddler2 中我没有在请求中看到 cookie,并且服务调用失败。向 RestRequest 添加 cookie 有什么技巧吗?

 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 });
        });

谢谢,艾尔

4

1 回答 1

1

在向 RestRequest 添加 cookie 时,RestSharp 在 Windows Phone 上有一个错误!

我解决了这个问题,并有一个拉取请求等待他们集成到主分支。

现在,您可以通过使用 AddHeader("Cookie", cookieValuesString)... 来解决这个问题。

于 2012-02-03T18:32:07.660 回答