views:

24

answers:

1

Am using Silverlight 4 hosted in an ASP.NET MVC page, e.g. ht tp://test.mysite.com/main. I make a call to the server from Silverlight using WCF and get some values back. One of these values I write as a cookie using:

HtmlPage.Document.SetProperty("cookie", newCookie);

I can then view the cookie text using:

MessageBox.Show(HtmlPage.Document.Cookies);

I can see various cookies, including the one I just created, so looks like it was created ok.

From within the SL app, I display some hyperlinks. When the user clicks on this it will display the link in a new browser window. The links go to the same domain, e.g. ht tp://test.mysite.com/viewdoc?1233

The new cookie that was created is not being passed in the request. The other cookies that were originally there are being passed. I don't see how its a crossdomain policy issue since they are going to the same domain. It doesn't matter what browser I use (Safari, Firefox, IE8, IE6), they all exhibit the same problem, so it doesn't seem to be an IE8 issue that I saw on other similar issues.

So where is my cookie going?

+1  A: 

Verify that the path property of the cookie is not set to certain page only:

The path parameter is potentially the most useful of the 4 optional cookie settings. It sets the URL path the cookie is valid within. Pages outside of that path cannot read or use the cookie. If Path is not set explicitly, then it defaults to the URL path of the document creating the cookie.

Darin Dimitrov
Thank you so much. This was indeed the problem.
therealtkd