1 cookie for multiple sites
Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=10101
Printed Date: 29 March 2026 at 6:44pm Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com
Topic: 1 cookie for multiple sites
Posted By: Scotty32
Subject: 1 cookie for multiple sites
Date Posted: 22 April 2004 at 4:55pm
|
does anyone know how i can have a cookie that works on mysite.com and sub.mysite.com??
ive successfully got 2 forums to work of one userlist, and id like people to be automatically logged in, so that i can have the edit profile etc on the master site
ive seen a feature in cookies about it, theres one on this site somewhere, but id like it if sumone could explain it to me please
------------- S2H.co.uk - http://www.s2h.co.uk/wwf/" rel="nofollow - WebWiz Mods and Skins
For support on my mods + skins, please use http://www.s2h.co.uk/forum/" rel="nofollow - my forum .
|
Replies:
Posted By: Mart
Date Posted: 22 April 2004 at 4:57pm
|
Hmm I thought that most users would not allow sub.mysite.com to read
cookies from mysite.com because that would be classed as a third party
cookie...
|
Posted By: Scotty32
Date Posted: 22 April 2004 at 5:38pm
|
oh damm
i just wanna be able to log into all sites thru one login pages
like MSN has
------------- S2H.co.uk - http://www.s2h.co.uk/wwf/" rel="nofollow - WebWiz Mods and Skins
For support on my mods + skins, please use http://www.s2h.co.uk/forum/" rel="nofollow - my forum .
|
Posted By: dpyers
Date Posted: 22 April 2004 at 6:46pm
|
I think MSN might use passport. They probably also write the cookies and session info to disk. When you navigate to another subdomain or domain within their realm, part of the http header, and prrhaps part of the url is a key to the disk info. If you google for "asp code server farm" you should be able to find some how-to's.
-------------
Lead me not into temptation... I know the short cut, follow me.
|
Posted By: zMaestro
Date Posted: 22 April 2004 at 10:36pm
|
I read that now most new browsers disabled this features, since it allows other sites to collect information about you, for example Amazon.com uses Cookies in order to track the items you searched for and your shopping cart as well, if this was possible, any site could know your interest by reading your cookies.
|
Posted By: Scotty32
Date Posted: 23 April 2004 at 4:59am
|
well i thought you had to state the cookie was going to be read by other sites and i got the impression from how it they was talking about it on jodohosts forums that this bit of code worked for a site and all its subdomains
Response.Cookies("MyCOOKIE").Domain = "mysite.com"
and i was wondering if anyone had more info on it eg if i had to put "sub.mysite.com" to write it for that site or if i could just put the above and it'd work for all my subdomains wither its "www." or "sub."
i guess i can tweek the forum to have a edit profile on both forums but i only wanted to have it on one forum becose of uploading Avatars would course problems between the sites
------------- S2H.co.uk - http://www.s2h.co.uk/wwf/" rel="nofollow - WebWiz Mods and Skins
For support on my mods + skins, please use http://www.s2h.co.uk/forum/" rel="nofollow - my forum .
|
Posted By: dpyers
Date Posted: 23 April 2004 at 8:15am
|
A "how-To" article at 15 seconds -
http://www.15seconds.com/issue/971108.htm - http://www.15seconds.com/issue/971108.htm
-------------
Lead me not into temptation... I know the short cut, follow me.
|
Posted By: Scotty32
Date Posted: 23 April 2004 at 8:55am
thanks, i'll give it a try 
------------- S2H.co.uk - http://www.s2h.co.uk/wwf/" rel="nofollow - WebWiz Mods and Skins
For support on my mods + skins, please use http://www.s2h.co.uk/forum/" rel="nofollow - my forum .
|
Posted By: SiteMaster
Date Posted: 30 August 2005 at 6:32am
|
i know it is an old post, but have someone got this to work, and if yes where do i put the 2 lines of code ?
Response.Cookies(strCookieName) = 1
Response.Cookies(strCookieName).Domain=".mydomain.com"
no matter where i put them in the code i get an cookie error when i log on
|
Posted By: Scotty32
Date Posted: 30 August 2005 at 6:39am
what error do you get?
and by "when i log on" are you talking about WebWizForum?
i think you set the .Domain when you set the cookie
------------- S2H.co.uk - http://www.s2h.co.uk/wwf/" rel="nofollow - WebWiz Mods and Skins
For support on my mods + skins, please use http://www.s2h.co.uk/forum/" rel="nofollow - my forum .
|
Posted By: SiteMaster
Date Posted: 30 August 2005 at 6:55am
|
yes when i log on to my forum that is on domain http://forum.sitemaster.dk - http://forum.sitemaster.dk i get this error
Un-Successful Login
Your login was un-successful due to a cookie problem.
Please ensure that all cookies are enabled on your web browser for this web site.
i want it so i can read the cookie from http://www.sitemaster.dk - http://www.sitemaster.dk and http://forum.sitemaster.dk - http://forum.sitemaster.dk
|
Posted By: Scotty32
Date Posted: 30 August 2005 at 7:07am
yeah, i added it to one of my sites, and am getting the same error
as you said, its an old thread, and am not sure if i ever tried it back then or not - not sure if i get round to it
------------- S2H.co.uk - http://www.s2h.co.uk/wwf/" rel="nofollow - WebWiz Mods and Skins
For support on my mods + skins, please use http://www.s2h.co.uk/forum/" rel="nofollow - my forum .
|
Posted By: theSCIENTIST
Date Posted: 30 August 2005 at 7:15am
I just get this to work, do this:
1. Create 2 files, coo1.asp and coo2.asp
2. coo1.asp goes into your www.yourdomain.com root
3. coo2.asp goes into your sub.yourdomain.com root
Here's the files for you to copy paste:
<%
'// File 1 - coo1.asp
Response.Cookies("cook") = "Pass me along please!"
Response.Cookies("cook").Domain = ".yourdomain.com"
Response.Write("Cookie set: [ " & Request.Cookies("cook") & " ]")
%> |
<%
'// File 2 - coo2.asp
Response.Write("Cookie retrieved: [ " & Request.Cookies("cook") & " ]")
%> |
Now open 2 browser windows;
1. On the first one go to [www.yourdomain.com/coo1.asp] make sure it reports cookie set.
2. On the second one, go to [sub.yourdomain.com/coo2.asp] make sure it returns the value of the cookie.
Make sure you change [yourdomain.com] to your actual domain in the code and URLs posted above.
This example works only when sharing stuff between sub-domains part of the same domain not between different domains.
I have encounter a problem when testing this in IE, maybe because of the high security settings I have here, but when testing on Firefox, it worked nicely, so if this don't work for you, could be because you browser is either blocking cookies or not allowing some kinds of it.
------------- :: http://www.mylittlehost.com/ - www.mylittlehost.com
|
Posted By: SiteMaster
Date Posted: 30 August 2005 at 7:31am
|
hhmm i reports the text but it did not write the cookie
|
Posted By: SiteMaster
Date Posted: 30 August 2005 at 8:00am
|
i dont get why it is not saving the cookie, if i go to my forum then it save a cookie
|
Posted By: theSCIENTIST
Date Posted: 30 August 2005 at 8:08am
It's your browser than, it's working, but your browser settings are blocking it at some point, disable all browser security and set it to allow all cookies, exit browser then re-open it again, or use a different browser, as I said above on my IE I couldn't see the cookie value on the second page, but on firefox it works perfectly.
------------- :: http://www.mylittlehost.com/ - www.mylittlehost.com
|
Posted By: SiteMaster
Date Posted: 30 August 2005 at 8:11am
|
i still dont get it, the cookie on my WWF works, so why dont it work if i make a simple cookie ?
|
Posted By: theSCIENTIST
Date Posted: 30 August 2005 at 8:37am
Ok, I just run more tests, it appears that if you use IE, there's no way it will work, I tried everything, allowing all cookies, setting the domain as allowed for cookies, nothing works, but in Firefox it does, so don't know why IE is behaving like this, try Firefox and you'll see it works just fine.
Are you setting the ".yourdomain.com" to your domain?
------------- :: http://www.mylittlehost.com/ - www.mylittlehost.com
|
Posted By: dpyers
Date Posted: 30 August 2005 at 7:41pm
And make sue there's a "dot" in front of yourdomain.com - e.g. .yourdomain.com
-------------
Lead me not into temptation... I know the short cut, follow me.
|
|