0

让我从显示代码开始:

    private async Task<bool> session()
    {
        string post = " ";

        HttpContent postContent = new StringContent(
            post,
            Encoding.ASCII,
            "application/x-www-form-urlencoded");

                using (HttpResponseMessage response = await this.httpClient.PostAsync(
                    "CANT_SHARE_URL.com/data", postContent))
                using (HttpContent content = response.Content)
                {

                    this.session =content.Headers.GetValues("session").FirstOrDefault();
                }
        return true;
    }

我不能透露网址。

问题是它没有设置会话变量,并且内容返回了标题,标题也显示在提琴手中。异常'System.InvalidOperationException' 我已经尝试了最明显的选项,它肯定会正确响应,并且我以某种方式将标题变成了一个字符串,但我不记得如何了。

4

1 回答 1

0

您确定会话标题在内容上吗?您是否尝试过查看 request.Headers 集合?

于 2014-03-27T18:16:35.230 回答