我使用 MSDN 示例创建了这个示例。
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(redirUri);
request.Method = "GET";
request.CookieContainer = new CookieContainer();
Trace.WriteLine("Created request to " + redirUri);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
// Right here I want to get JSESSIONID, but Cookies are empty
foreach (Cookie cook in response.Cookies)
{
Debug.WriteLine("{0} = {1}", cook.Name, cook.Value);
}
无法获取 JSESSIONID。我需要在一个会话中进行多个 GET/POST 查询,这就是我需要 JSESSIONID 的原因。请帮帮我。