我的 asp.net 2.0 应用程序向另一个 URL 发出内部 https 请求,以在响应中获取有效的 cookie。
当我在 .Net 2.0 框架中对此进行测试时,不会返回任何 cookie,但是在 .Net 4 中它确实有效。响应中也不例外,但我的直觉是它与公司代理和 https 有关。除了升级到.Net 4.0(巨大的任务)之外,还有什么建议吗?
string ticketissuerURL = "https://Securesite";
ServicePointManager.Expect100Continue = false;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(ticketissuerURL);
// Set some reasonable limits on resources used by this request
request.MaximumAutomaticRedirections = 4;
request.MaximumResponseHeadersLength = 4;
request.KeepAlive = true;
request.AllowAutoRedirect = false;
request.PreAuthenticate = true;
// Pass in current credentials
request.UserAgent = "Mozilla/4.0 (Windows)";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();