Universal Windows Platform (UWP)
A Microsoft platform for building and publishing apps for Windows desktop devices.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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.
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.
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:
Call the method again and you can see that cookies are not added from the previous call.
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:
We will start testing as soon as possible and look forward to your reply. If any news, I will post it here.
1) It's in the debug state
2) Cookies are allowed in Edge, I checked this a while back to be sure and recently double checked it. The option is set to "Don't block cookies"
3) I log into the same account which I use to test on PCs. It does not have restrictions and the Xbox One actually requires you to log into an account before you can run a debug session.
You may need to use Fiddler in order to see that no cookies are added from the first HttpClient call to any subsequent call when using the same domain. On the PC, you can see that cookies are automatically added when using the same domain.
Hi, According to the test results of the engineer, on Xbox,
HttpBaseProtocolFiltercan record cookies normally and bring them into the next request. So we cannot reproduce your problem. You can try to update your Xbox to make sure it is up to date. If the problem persists, you can try another Xbox device or potentially an Xbox that has just been through the OOBE to set it up like new.
I've made a test program using the above code and I do see the cookies being recorded and used for subsequent requests. However, in my app I'm not seeing this occur. What are the situations in which the cookies would be cleared other than calling WebView.ClearTemporaryDataAsync()?
Hi, there are many possibilities to clear cookies, such as those I mentioned above (user settings, or blocking cookie records in Edge, etc.) Without these, the cookie will not be cleared under normal circumstances, but if the cookie itself expires, or if the cookie is manually set to empty, the original cookie will also be cleared. You can check whether you have set the cookie code manually, or screen the network request to see if there is a similar situation.
I don't believe it is something in the code, there has to be a difference between the PC and the Xbox One in some area. The same code on the PC retains cookies but on the Xbox One it does not within our application, but I have not been able to narrow it down. I do some have some ideas to try in my sample project. If I find something, is this the best place to report it?
Indeed, this is not a problem with the code. According to the test results of the engineers, cookies are still retained on the Xbox, which may be related to some settings of the device. If you have new test results, you can choose to post them here. It is best to provide your test code sample, Xbox device type and system version. You can also go to the "Feedback Hub" application in Windows 10 to report your problems.
It took a bit of work, but after removing assemblies one by one, it turns out the Microsoft Advertising SDK is what was causing cookies to not be shared. Since the SDK is being deprecated on June 1, we've removed it from our apps. Likely it had something to do with the XBox One crashing fix they put in over a year ago.
I am very happy that you have found the cause of the problem, which is also a help to us. You can write the solution as an answer and accept it. This will help more people who meet the same problem.
Sign in to comment