让我首先展示代码:
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;
}我不能透露网址。
问题是它没有设置会话变量,并且内容已经返回标头,标头也显示在fiddler中。例外的'System.InvalidOperationException‘,我已经尝试了最明显的选项,它肯定是正确的反应,我以某种方式将头放入一个字符串中,但我不记得是怎么回事。
发布于 2014-03-27 18:16:35
您确定会话头在内容上吗?您试过在request.Headers系列中查找吗?
https://stackoverflow.com/questions/22694495
复制相似问题