Click here to Skip to main content
15,512,456 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I understand that is not possible to share cookies across totally different domains but if there is another alternative please let me know. My scenario is as following:

On my web application there is one page (www.mydomain.com/somepage.aspx). When this page is visited, On Page Load, I do a GET Request with HttpWebRequest object to another website (www.anotherdomain.com/Login.aspx) to obtain a necessary cookie in order to send it later in a POST request at the same page.

Within the HttpWebResponse of the GET Request I get one cookie that I need to store on the browser programmatically with the same domain (www.anotherdomain.com)

The problem is that when I add that cookie that is in my response with the domain (which I made the HttpWebRequest) cookie is not added.

I need to store that cookie in the browser because the Login.aspx page require it in order to let the user pass the login page without the need of entering the credentials.

How could I successfully accomplish this scenario?
Posted

1 solution

If I understand your scenario correctly you want to store the cookie that comes from one domain in page belonging to another domain.I think cookie is associated with a particular domain.HttpCookie has a property Domain which contains the domain of the cookie.

I think you can try to set the Domain property for this scenario.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900