C# 如何使用cookie Windows Phone c

C# 如何使用cookie Windows Phone c,c#,cookies,windows-phone-8,C#,Cookies,Windows Phone 8,我有问题。 我在主页上有代码: private async Task<string> Login(string username, string password) { try { string url = "myurl.com/page1"; Uri address = new Uri(url); var postData = new List<KeyV

我有问题。 我在主页上有代码:

      private async Task<string> Login(string username, string password)
    {
        try
        {
            string url = "myurl.com/page1";
            Uri address = new Uri(url);
            var postData = new List<KeyValuePair<string, string>>
                           {
                 new KeyValuePair<string, string>("Login", username),
                 new KeyValuePair<string, string>("Password", password)
                           };
            CookieContainer cookieJar = new CookieContainer();
            HttpContent content = new FormUrlEncodedContent(postData);
            var handler = new HttpClientHandler
            {
                CookieContainer = cookieJar,
                UseCookies = true,
                UseDefaultCredentials = false
            };

            var client = new HttpClient(handler)
            {
                BaseAddress = address
            };

            HttpResponseMessage response = await client.PostAsync(url, content);

            string UrlBase = "myurl.com/page1";
            Uri uri = new Uri(UrlBase);
            var responseCookies = cookieJar.GetCookies(uri);
            foreach (Cookie cookie in responseCookies)
            {
                string cookieName = cookie.Name;
                string cookieValue = cookie.Value; 
            }    
            response.EnsureSuccessStatusCode();
            string body = await response.Content.ReadAsStringAsync();
            return body;
        }
         catch (Exception e)
        {

            return e.ToString();

        }

    }
但在调试中,我看不到cookies。他的号码是0。 我不知道,我怎样才能在page2.xaml上找到myurl.com/page2?
如何使用和保存Cookie?

如何获取和设置Windows Phone 8的Cookie


我试过这个方法,但是我没有得到饼干。我无法获取页面的html代码。我也尝试过,但没有得到cookies,您能提供其他解决方案吗