加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – WP 7.1上的Restsharp添加cookie

发布时间:2020-12-15 21:19:43 所属栏目:百科 来源:网络整理
导读:我正在尝试使用RestSharp向请求添加cookie但在fiddler2中我没有看到请求和服务调用中的cookie失败.向RestRequest添加cookie有一些技巧吗? RestRequest rq = new RestRequest(LTV.NowNext(),Method.GET); rc.AddDefaultParameter(LTV.cookie.Key,LTV.cookie.
我正在尝试使用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 });
        });

谢谢,

解决方法

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

我解决了这个问题并让pull request等待它们集成到主分支.

目前,您可以使用AddHeader(“Cookie”,cookieValuesString)来解决此问题…

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读