Storing Cookies Windows Store App
Asked Answered
F

2

14

As I discovered here, when I make a call to a server to ask for authentication in the form of a cookie, the cookie in the response is handled automatically by the underlying metro framework.

However, this means I don't have access to the cookie and, therefore, cannot store it when the app is suspended for later use. How are we supposed to store cookie information in the metro framework?

All help is greatly appreciated and I always accept an answer!

Fumy answered 6/8, 2012 at 20:50 Comment(8)
So you are basically asking how to transfer the cookies from the web compartment to the local compartment? Or, your not seeing the HTTP only cookie being kept away from the rest of the app? You have access to document.cookies, but I assume that's not working for Http Only.Diaphoretic
document.cookies returns undefined and document.cookie returns an empty string. I have tried both HTTPOnly cookies and non-httponly cookies, but the results for both kinds are the sameFumy
So you are making an XHR, and you can't access the HTTP Only cookies? I thought that was the point of HTTP Only cookies?Diaphoretic
No, the problem is that I cant access ANY cookies.Fumy
@DanielH. The answer to this question https://mcmap.net/q/902636/-cookies-in-windows-8-winjs/… should be helpful to you.Skier
@Konstantin That is for ie10 what about win metro framework? These are apples and oranges. While I do not know the metro framework at all I have quite a bit experience with Android. Cookies are useless there. Local storage options (besides cookies) are what you need.Automation
And what about using sessionStorage and ajax?Tamalatamale
There is a known issue on Windows Phone apps regarding the subdomain of a cookie coming back - it will show as empty. See this Stack Overflow Question for someone with similar issues it's well documented by the OP.Switcheroo
C
0

You wrote

cannot store it when the app is suspended for later use

I used Google Analytics in my Windows Store application, and I can say that cookies were successfully stored. You may ensure by checking the following filesystem location:

C:\Users\XXXX\AppData\Local\Packages\XXXXXX\AC\INetCookies

Docs at MSDN (link) also confirm that Cookies are supported method of storing user data.

If I understand correctly your question: you do not need take any additional action to accept and store network cookies in Windows Store apps.

Chiffon answered 9/9, 2013 at 13:40 Comment(0)
M
1

We implemented sessionStorage for sessions and localStorage for persistence as a complete cookie replacement in our Windows 8 app and it has worked very well. Both storage engines are extremely straightforward to use, you can read up on them here: https://developer.mozilla.org/en-US/docs/Web/Guide/DOM/Storage

Mattress answered 6/9, 2013 at 2:22 Comment(0)
C
0

You wrote

cannot store it when the app is suspended for later use

I used Google Analytics in my Windows Store application, and I can say that cookies were successfully stored. You may ensure by checking the following filesystem location:

C:\Users\XXXX\AppData\Local\Packages\XXXXXX\AC\INetCookies

Docs at MSDN (link) also confirm that Cookies are supported method of storing user data.

If I understand correctly your question: you do not need take any additional action to accept and store network cookies in Windows Store apps.

Chiffon answered 9/9, 2013 at 13:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.