GW-0235 avatar image
0 Votes"
GW-0235 asked RichardZhang-MSFT commented

Why are Xbox One cookies lost after each HttpClient call and not persisted as stated in the Windows.Web.Http documentation?

Xbox One cookies using Windows.Web.Http are not updated and persisted after each HttpClient call and reused for any subsequent HttpClient call. Cookies have to be manually persisted and added before each HttpClient which not only problematic, but requires keeping separate code paths for Xbox One and PC / Desktops.

· 11
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello, have you tried to create HttpBaseProtocolFilter before creating HttpClient? like this:

 HttpBaseProtocolFilter filter = new HttpBaseProtocolFilter();
 var client = new HttpClient(filter);

HttpBaseProtocolFilter can help you save the cookie information without having to repeat the setting every time.

0 Votes 0 ·
GW-5681 avatar image GW-5681 RichardZhang-MSFT ·

Yes, we are doing that with each HttpClient call. This works on PCs, but cookies are not cached on the Xbox One. This is easily reproduced in Xbox One's Dev Home. Make a HttpClient call to any website such as the following in its own method:

 HttpBaseProtocolFilter filter = new HttpBaseProtocolFilter();
  using(var client = new HttpClient(filter))
       string result = await httpClient.GetStringAsync(new Uri(url));

Call the method again and you can see that cookies are not added from the previous call.

0 Votes 0 ·

Sorry for the late reply, I am making a demo to try to reproduce your question. Before this, you need to confirm a few questions with you:

  1. When you test your app on Xbox, is it in the debug state or is the release version installed from the store?

  2. Is the setting to block cookies on your XBOX? (Open the Edge browser, there is an ellipsis button in the upper right corner, click the button and enter the settings, find the section about privacy and security, you can check whether the cookie is blocked).

  3. Did you log in to your account during the test on Xbox, and did your account have content restrictions enabled?

We will start testing as soon as possible and look forward to your reply. If any news, I will post it here.

0 Votes 0 ·
Show more comments

0 Answers