locked
Cookies not going through with WebView.navigateWithHttpRequestMessage()

    Question

  •         var webview = document.getElementById("WebView");
            var httpRequestMessage = new Windows.Web.Http.HttpRequestMessage(
                    Windows.Web.Http.HttpMethod.get,
                    new Windows.Foundation.Uri("https://someurl.com")
                );
    
            httpRequestMessage.headers.cookie.tryParseAdd("onecookie=a;somecookie=b");
    
            webview.navigateWithHttpRequestMessage(httpRequestMessage);

    This code is called after the complete promise after WinJS.UI.processAll(). In fiddler I see that the request looks like this:

    GET https://someurl.com HTTP/1.1
    Accept: text/html, application/xhtml+xml, */*
    Accept-Language: en-US
    X-P2P-PeerDist: Version=1.1
    User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; Trident/7.0; Touch; MSAppHost/2.0; rv:11.0) like Gecko
    UA-CPU: AMD64
    Accept-Encoding: gzip, deflate, peerdist
    Host: someurl.com
    Connection: Keep-Alive
    X-P2P-PeerDistEx: MinContentInformation=1.0, MaxContentInformation=1.0

    The webview is defined in a `HubSection` in html as follows:

        <x-ms-webview id="WebView" width="100%" height="100%" />

    This must be a bug. I step through and the cookies are set correctly, but the webview just seems to ignore them. Any workarounds?


    • Edited by Caleb Jares Wednesday, May 21, 2014 8:49 PM
    Wednesday, May 21, 2014 7:39 PM

Answers

All replies