简体   繁体   English

经典asp应用程序session在Response.Redirect后丢失

[英]Classic asp application session lost after Response.Redirect

Code is hosted on same server with two different domain one is Internal testing(abc1.com) and External testing(abc2.com) and different app pool for them, code is same and folder structure is same.代码托管在具有两个不同域的同一服务器上,一个是内部测试(abc1.com)和外部测试(abc2.com),它们的应用程序池不同,代码相同,文件夹结构相同。

Session lost issue only for only one domain abc2.com. Session 仅针对一个域 abc2.com 丢失问题。

Session set from one page and after Respone.Redirect trying to access session is lost in case of External testing site only. Session 从一页设置并在 Respone.Redirect 之后尝试访问 session 仅在外部测试站点的情况下丢失。

Any one having any clues.任何有任何线索的人。 How to troubleshoot issues?如何解决问题?

There are actually two problems here;这里实际上有两个问题;

As @John rightfully mentioned in the comments, if the domains don't match then your sessions aren't carried over.正如@John 在评论中正确提到的那样,如果域不匹配,那么您的会话不会被延续。 The reason is that for sessions to work classic ASP issues a unique cookie per visitor.原因是会话正常工作的经典 ASP 会为每个访问者发出一个唯一的 cookie。 Cookies are bound to a (sub)domain, if you run on two different (sub)domains the cookies set on one domain can't be read by the other domain.Therefore the session on one domain won't be matched to the other domain. Cookies 绑定到一个(子)域,如果您在两个不同的(子)域上运行,则在一个域上设置的 cookies 无法被另一个域读取。因此,Z21D6F40CFB511982E4424E0E250 不会匹配到另一个域领域。

Unfortunately that still won't solve your problem completely, because each application pool in Classic ASP also creates it's own session cookie.不幸的是,这仍然不能完全解决您的问题,因为 Classic ASP 中的每个应用程序池也会创建自己的 session cookie。 That's why increasing processes on your application pool will also result in a messed up session scope.这就是为什么增加应用程序池上的进程也会导致混乱的 session scope。

So in short, sessions in classic ASP only work in the same domain using a single application pool process.所以简而言之,经典 ASP 中的会话只能在使用单个应用程序池进程的同一域中工作。 The ony way to work around this is to write your own session scope, issue your own cookies per user, and store corresponding variables in a backend of your own.解决此问题的唯一方法是编写您自己的 session scope,为每个用户发出您自己的 cookies,并将相应的变量存储在您自己的后端。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM