Windows Vista Beta | WinVistaBeta.com - Message | Application.GetCookie() doesn't get browser cookies

July 03, 2008  
Subject: Application.GetCookie() doesn't get browser cookies
Group: microsoft.public.windows.developer.winfx.sdk
Date: 11/15/2006 9:04:51 AM
From: "Shan McArthur" [Email Address Protection]

Hello,

I am having problems using Application.GetCookie() within a browser-deployed
XBAP application. I know the browser that is hosting the XBAP application
has cookies (including the ASP.NET session cookie). When I get the XBAP
application to call Application.GetCookie, it throws the following
exception: No more data is available (Native Error Code=259).

I notice that if I call SetCookie(), then GetCookie() retrieves a value.
That said, the important part is to get the browser's session cookie so that
the XBAP application can interact with the host website.

Does anyone know how to get the cookies from the host browser of an XBAP
application?

Thanks,
Shan McArthur



Back
Subject: Re: Application.GetCookie() doesn't get browser cookies
Group: microsoft.public.windows.developer.winfx.sdk
Date: 1/8/2007 8:09:27 AM
From: "Shan McArthur" [Email Address Protection]

Thanks for the reply, but that solution will not work. The XBAP application
does not integrate with browser session cookies at all, nor will it work in
websites that use https cookies that are not written to the hard drive.
Using this suggestion, if the browser cookie changes, the XBAP application
would be unable to detect it and would be using old values. In addition, it
would require an insecure web service to pass values from the browser to the
XBAP and the application would be very sensitive to communication issues. I
have seen the website example of communicating between an XBAP application
and a browser through a web service, but the application breaks frequently -
there is no way that form of communication is qualified for enterprise
development.

Unfortunately, this completely cripples a developer from integrating an XBAP
application into a browser-based application. Cookies have been part of the
HTTP specification from the start and are required to build session-based
web applications. It is very unfortunate that Microsoft did not consider
the needs of developers using the technology before they rushed this out the
door. As a minimum, integration with the browser session cookies as well as
rudimentary communication with the hosting window (equivelent of
window.opener or window.frame.top) is an absolute requirement, and without
these two basic capabilities, XBAP will be unsuitable for web development.

Shan
<adrianca@gmail.com> wrote in message
news:1165327024.169541.169870@79g2000cws.googlegroups.com...
> Could you use some common server-side web service code for both the ASP
> and XBAP to to set/get the sessionid
> eg: http://geekswithblogs.net/lbugnion/archive/2006/10/11/93743.aspx
>
> Shan McArthur wrote:
>> Here is a quick update on the problem:
>>
>> XBAP cannot retrieve session cookies from the IE browser that is hosting
>> the
>> XBAP application. It can retrieve persistent cookies that are written to
>> the hard drive. The lack of session cookie support makes it impossible
>> to
>> integrate a new XBAP application into an existing web application that
>> uses
>> forms authentication or any session information. Microsoft is planning
>> on
>> fixing this issue in a future release of WPF.
>>
>> "Shan McArthur" <shan_mcarthur@spamcop.net> wrote in message
>> news:ODpKLANCHHA.4428@TK2MSFTNGP04.phx.gbl...
>> > Hello,
>> >
>> > I am having problems using Application.GetCookie() within a
>> > browser-deployed XBAP application. I know the browser that is hosting
>> > the
>> > XBAP application has cookies (including the ASP.NET session cookie).
>> > When
>> > I get the XBAP application to call Application.GetCookie, it throws the
>> > following exception: No more data is available (Native Error Code=259).
>> >
>> > I notice that if I call SetCookie(), then GetCookie() retrieves a
>> > value.
>> > That said, the important part is to get the browser's session cookie so
>> > that the XBAP application can interact with the host website.
>> >
>> > Does anyone know how to get the cookies from the host browser of an
>> > XBAP
>> > application?
>> >
>> > Thanks,
>> > Shan McArthur
>> >
>



Back