让Session对象在不同域名下实现共享

2016-01-29 18:03 3 1 收藏

让Session对象在不同域名下实现共享,让Session对象在不同域名下实现共享

【 tulaoshi.com - ASP 】

  There is a general belief among developers that session state maintenance is always against one
domain / site. And therefore one can not maintain session state across different domains. Usually there is
no such requirement to maintain session state across different domains. But of late due to increase in the
scope of web based applications developers feel the need to share the session state with other domains.
The other domain may be a sister concern of the same company, or may be the B2B partner. So the question
arises how one can share the session variables across other domains easily and safely.

--------------------------------------------------------------------------------


  
How to share Session variables across Domains


Introduction  
      There is a general belief among developers that session state maintenance is always against one
domain / site. And therefore one can not maintain session state across different domains. Usually there is
no such requirement to maintain session state across different domains. But of late due to increase in the
scope of web based applications developers feel the need to share the session state with other domains.
The other domain may be a sister concern of the same company, or may be the B2B partner. So the question
arises how one can share the session variables across other domains easily and safely.

  

Sharing Session variables using aSMS  
     
      Configure aSMS


      Sharing Session variables across domains is very easy using aSMS. aSMS Standard and Advanced both
support sharing session variables. Lets assume two different domains mydomain1.com and mydomain2.com. And
the requirement is to share the session variables between mydomain1.com and mydomain2.com. For simplicity
sake lets assume one webserver each for mydomain1.com and mydomain2.com. (It’s also possible so share
session variables between different domains hosted on same webserver). So www.mydomain1.com points to
webserver of domain1 and www.mydomain2.com points webserver of mydomain2.com.

Install aSMS on both webservers. Both aSMS should share a common LDAP server to share session variables.
Lets assume that common LDAP server be ldap.mydomain.com. On the webserver of mydomain1.com, open the aSMS
Admin Console.

For the,

LDAP Path enterLDAP://ldap.mydomain.com:1002/o=mydomain/ou=Members
LDAPAdminentercn=Administrator,ou=Members,o=mydomain

Enter the Admin Password. Set your Session Time out duration. If you want to support cookies then set
Support Cookies to True.




Click ‘Test LDAP Source’ button. If it returns ‘Successful’ Then aSMS has been configured successfully
on the webserver of mydomain1.com.




Do the same on the webserver of mydomain2.com. Take care to enter the same LDAP path
(LDAP://ldap.mydomain.com:1002/o= mydomain/ou=Members)for the webserver of mydomain2.com. This way we
ensure that aSMS of both webservers point to the same LDAP Server. Test LDAP connection by clicking ‘test
LDAP source’ button. If it returns successful then aSMS has been configured properly on webserver of
mydomain2.com also and they both point to the same LDAP server.

  
     
Start Session on Webserver of mydomain1.com


  One can use the functions.asp (link to function.txt) given in the sample files and include this file in
all asp pages. If functions.asp has been used then Session can be started by just calling SessionStart
function on the default.asp of mydomain1.com webserver.

If function.asp is not used, then following code can be used to start the session in default.asp page

< %

Set objSession = Server.CreateObject("Session.Managem

来源:https://www.tulaoshi.com/n/20160129/1504139.html

延伸阅读
标签: 办公软件
前段时间,单位负责培训的小王问了我这样一个问题:在PowerPoint中的同一张幻灯片上插入了两张图片,设置它们的动作后,只能一幅一幅地显示出来,能否实现这两张图片的同时动作?当时我被他这么一问,就糊里糊涂地回答他说不行,因为无论在PowerPoint 2000还是PowerPoint XP中,自定义动画时不同的对象都有一个“动画顺序”的先后问题。但...
标签: Web开发
Cookie 真是一个伟大的发明,它允许 web 开发者保留他们的用户的登录状态。然而,当你的站点或网络有一个以上的域名时就会出现问题了。 在 Cookie 规范上说,一个 cookie 只能用于一个域名,不能够发给其它的域名。因此,如果在浏览器中对一个域名设置了一个 cookie,这个 cookie 对于其它的域名将无效。如果你想让你的用户从你的站点...
标签: PHP
Cookie真是一个伟大的发明,它允许web开发者保留他们的用户的登录状态。然而,当你的站点或网络有一个以上的域名时就会出现问题了。 在Cookie规范上说,一个cookie只能用于一个域名,不能够发给其它的域名。因此,如果在浏览器中对一个域名设置了一个cookie,这个cookie对于其它的域名将无效。如果你想让你的用户从你...
实在说,我对delphi的理解不是很深入,使用它写过一些小程序,不过鉴于borland的传奇,还是看了李维那本vcl内幕剖析,最终的感觉不是对delphi多么狂热,反而是另样的深入理解了c++的优缺点以及模式设计一些理念的深化,不过,仍旧对borland抱有尊敬,另外也羡慕那些使用delphi的人,控间好多啊,:)这个是我早期从bbs上收集的文章,暂...
标签: Web开发
在已经发表的系列文章中我们已经讨论了两个ASP对象:Application对象和Session对象,因此能够访问Application对象和Session对象提供的集合、方法、属性和事件。本节将从程序设计的角度对这两个对象进行研究。 当载入ASP DLL并响应对一个ASP网页的第一个请求时,创建Application对象。该对象提供一个存储场所,用来存储对于所有访问者...

经验教程

893

收藏

41
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部