locked
Unable to retrieve all the set cookies

    Question

  • I am using an authentication cookie to enable easy access to a webserver in my store app.

    Whenever a very first call is attempted to the server, it will set the cookie for me in the response along with other minor info cookies.

    I used a httpcookiecollection class to iterate through the list of cookies I'd received and to fetch their values.

    HttpCookieCollection^ cookieCollection = filter->CookieManager->GetCookies(resourceAddress);

    Actually through fiddler i could see 4 cookies set in the response header whereas the list I obtained through the collection has only 3. My important authentication cookie is missing from the list. I want to retrieve its value and use it further.

    Can someone please help me in figuring out whats going wrong here ?

    Thanking you in advance !!

    Thursday, November 28, 2013 8:00 PM

All replies

  • Hi Minu7,

    Take a look at the documentation: Understanding and debugging the web authentication broker workflow

    The Web authentication broker enables single sign-on (SSO) by allowing persisted cookies in a special purpose SSO app container. To use this container, your app can call the overload of the AuthenticateAsync method that does not take a callback URI.

    I think this might be the reason why your cookie is missing, it restore in a different container and Cookie manager cannot get it.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Friday, November 29, 2013 9:23 AM
    Moderator
  • Hey

    Let me go through this article and get back. Meanwhile, actually we are using our own version of http client inerface for the request/response and for cookies too.

    I saw this happening just on a single ultrabook but not on other regular desktops/tablets. That's when i thought i would try using windows APIs to check the behavior.

    In face, the cookie that cookiecontainer is failing to retrieve is basically a token for easing further calls to the same server as such.

    Thanks !!

    Friday, November 29, 2013 10:28 AM
  • Additionally these are my cookies set in the response header (third one's size should be around 3400+ bytes of data, i've shortened it but it ends with ==).

    I am getting the other three except the requiredtoken. This is driving me crazy, I have no issues in desktops/tablets though.


    Set-Cookie: culture=en-US; expires=Sat, 29-Nov-2014 08:27:10 GMT; path=/; HttpOnly


    Set-Cookie: ASP.NET_SessionId=efsdfd4545pfhdfq; path=/; HttpOnly

    Set-Cookie: MyrRequiredtoken=sdgdsgsdgdsgsdgdgds123sg+wDy4AgD4I8y/QYRUEX/N6e6ouRAgXvD6vXN+dgsdgdsgdgNGsddsgdsg9890+j9otD+Ga+g92a==; expires=Fri, 29-Nov-2013 16:27:11 GMT; path=/


    Set-Cookie: server_sdgsgd-sdgd-sdgdsg.nsdgdsg.com=123223411.12345.1111; path=/

    Friday, November 29, 2013 1:25 PM