views:

1704

answers:

3

I know this question has been asked before, but many answers don't give clear samples with codes on how to do this using ASP.NET 2.0. A simple C# is preferred, but I can also accept VB.NET or F#.

This third party cookies question is a sample of a self answered question with the same topic, but it didn't give any clues about reading/getting the third party cookies.

A: 

This is basically a cross site scripting "feature". What you need to do is run code on the client which reads the cookies and somehow transfer the contents to somewhere else. This is typically done via a query.

But before you do that, please think about this for a moment. There's a reason you shouldn't be able to read cookies from third parties in the first place.

Brian Rasmussen
I know the risk. But I'm eager to know, since the third party cookies will also be created by me.
eriawan
I think there's no clear answer, but yours is the most clear of all. I'm voting this!
eriawan
A: 

It is a security feature that one can only read cookies from the same domain that created the cookies. Trying to read "foreign" cookies is a sign of malicious intentions.

lothar
A: 

As others have already said, browsers do not serve cookies set in one domain to other domains for obvious security reasons. If you are creating the pages in both domains as you claimed in one of your comments, I believe you can access to the cookie information on the other domain by using an <iframe> html element, but I've never tried it myself.

muratgu
It's quite a good idea, but using IFRAME can be blocked by IE 7+ and Firefox 3, and can be considered as XSS attack.
eriawan
@eriawan: anything can be blocked, including cookies.
muratgu