【发布时间】:2012-11-14 21:43:30
【问题描述】:
构建与使用 JSESSIONID cookie 的站点交互的 ASP.Net 应用程序。 我得到的规范说要在每个请求中返回 Cookie。 我从登录响应的标头中提取 cookie OK,但是当我尝试在以下请求中使用它时,出现“PlatformNotSupported 错误” 显然,这是由于安全性的“改进”。 我看到博客谈论编写代理服务器以及创建从 IHttpModule 派生的类。 我很困惑。 是否有直接推荐的编码 HttpWebRequest 的方法以便我可以传输 Cookie?
StackOverflow 的不常用用户,尝试发表评论,失败,所以编辑帖子。 代码是: string cookie = "JSESSIONID=" + Session["SessionId"].ToString();
if(Request.Cookies["JSESSIONID"]==null)
{
//Request.Headers.Add("Cookie",cookie);//PlatformNotSupportedError
HttpCookie cook = new HttpCookie("JSESSIONID", Session["SessionId"].ToString());
Request.Cookies.Add(cook);
} //The prev login response had the cookie in the header not in the cookies collection so I was trying to send back the same way. ASP.net app at this stage. Will be service after get it going. Thx Bob
【问题讨论】:
-
Bob 您有可以发布的代码示例吗?您是否偶然尝试通过网络服务进行此操作..?