日期:2011-04-08  浏览次数:20962 次

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.