views:

105

answers:

3

If I have an ASP.NET page making a request to a page in a different web site/server and that page tries to write a cookie, what will happen? Will I have a cookie in the client machine? In the server of my first site? Will it be blocked because of some security issues?

Tks in advance!

A: 

Are you making the request through JavaScript (AJAX) or on the server-side? If the former, it won't work unless the two sites are on the same domain. If the latter, the client will be unaffected (the first server will handle any cookie storage).

Matthew Flaschen
Well, the idea is having multiple sites to send login credentials to a page in a centralized site, like an authentication provider. That authenticator would write a cookie in the client machine to allow single sign on between sites, which are in separate domains.But for that to work, I would need to make my authenticator read and write a cookie in the client.
Dante
A: 

If your server making request, it will store cookies

Fujiy
A: 

If you are making a request using WebClient or WebRequest, ... the server will send the cookies. If you want you should read those cookies from the response and store it somewhere. Otherwise, it'll be discarded.

Mehrdad Afshari
Hmm, interesting. Going to investigate. Tks!
Dante