PhilBrown
PhilBrown

Reputation: 3009

Cookies in the new browser when using HyperlinkButton in Silverlight

When you use the HyperlinkButton control in silverlight in IE to open a link in a new window using TargetName="_blank", does the new window have the same cookies as the original IE window. If not, how do you make it have the same cookies?

Upvotes: 4

Views: 359

Answers (2)

PhilBrown
PhilBrown

Reputation: 3009

When I say the windows 'have' cookies, I'm referring to what the browser has in it's cookie cache. It appears that what the browser launched from clicking on a SL HyperlinkButton control has cached is stale, ie; the JSESSIONID is from a previous session. Right now, we've hacked it so that we call System.Windows.Browser.HtmlPage.Window.Invoke("openUri", someURL), where openUri is a JS function which calls window.open(someUrl, "_blank"). It appears the difference here is that with the SL implementation, a new instance of IE is launched with stale cache. With the JS implementation, the new window is launched under the same process. Is there a way to mimick the js implementation with the hyperlinkbutton?

Upvotes: 0

AnthonyWJones
AnthonyWJones

Reputation: 189505

Well windows don't have cookies, the HTTP Request will have cookies. The cookies included in the request will be determined by the cookies in the browsers cookie cache and the URL being requested.

Hence in a typical case where you have application cookies set by responses from an ASP.NET application and they you open a new window to display another url in the same application the request for that url will carry those cookies previously set.

Upvotes: 2

Related Questions