Open Url&将CookieContainer设置为Phone Web Browser

时间:2015-05-15 08:49:24

标签: c# windows-phone-8.1 win-universal-app

我正在使用C#和Windows Phone 8.1作为通用。

我使用此代码将cookieContainer设置为HttpWebRequest并访问我的网站。

    CookieContainer cookieContainer = new CookieContainer();

    public async Task<string> Begin(string url, bool saveCookie = false)
    {
        string pageSource = "";
        HttpWebRequest request;
        request = (HttpWebRequest)WebRequest.Create(url);
        //request.Method = "Get";
        if (cookieContainer != null && saveCookie)
            request.CookieContainer = cookieContainer;

        try
        {
            HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync();
            pageSource = new StreamReader(response.GetResponseStream()).ReadToEnd();
            pageSource = System.Net.WebUtility.HtmlDecode(pageSource);
        }
        catch { }
        return pageSource;
    }

现在我必须使用Phone Web Browser {Internet Explorer}(forPayment页面)打开一个URL。如何将这个CookieContainer的网址发布到IE?

我也知道这段代码可以启动网址&gt;

            var options = new Windows.System.LauncherOptions();
            options.TreatAsUntrusted = false;
            await Windows.System.Launcher.LaunchUriAsync(new Uri("url"), options);

感谢。

0 个答案:

没有答案