Login
15 Seconds : Sharing Cookies Across Domains
strReturn=Server.URLEncode(Request("Return")) Response.Cookies("UID")= UID Response.Cookies("UID").Domain=".slave.com" Response.Cookies("UID").Expires = "December 31, 1999" Response.Redirect("http://slave.com/test.asp?Return=" & strReturn) %> Now we can add test.asp which tests to make sure that the cookie took. Here is what the code looks like: Example 8 : return.asp <% UID = Request.Cookies("UID") If Not ((IsNull(UID)) OR (Len(UID)=0)) Then strReturn=Request("Return") Response.Redirect(strReturn) End If %> <HTML> <BODY> <H1>You must a browser that accept cookies on http://slave.com</H1> </BODY> </HTML> Performance If the user doesn't have a cookie from myserver.com and he requests a page that has cookie.inc included, they will be issued a cookie. This scenario is the best case scenario. If the user doesn't have a cookie from slave.com and he requests a page that has getcookie.inc included and they haven'
