我们正在使用网站的Web服务与外部服务器进行通信。 外部服务器请求会话ID。HttpWebRequest:如何获取会话ID
我们下面的代码向外部服务器:
HttpWebRequest webRequest = WebRequest.Create(ExtUrl) as HttpWebRequest;
webRequest.Credentials = new NetworkCredential(ExtAccountToUse, ExtPassword);
HttpWebResponse webResponse;
webRequest.Method = "POST";
webRequest.ContentType = "application/x-www-form-urlencoded";
StreamWriter writer = new StreamWriter(webRequest.GetRequestStream());
writer.Write(xmlOutput);
writer.Close();
webResponse = webRequest.GetResponse() as HttpWebResponse;
是否有可能得到一个会话ID发送到外部服务器?
感谢您的时间
您似乎在发送XML(xmlOutput),但您将内容类型设置为标准HTML表单文章,这有点奇怪,为什么不使用“text/xml”作为内容类型? – AnthonyWJones 2009-08-25 09:52:28
外部服务器以什么方式“请求会话ID”。 – AnthonyWJones 2009-08-25 09:53:21
外部服务器在发送给服务器的第一个请求上是否要求会话ID?因为应该由目标服务器负责生成一个有效的会话标识,然后可以在客户端中重新使用它。 – 2009-08-25 09:56:12