When you use the HyperlinkButton control in silverlight in IE 开发者_如何学Cto 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?
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.
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?
精彩评论