Exemplo n.º 1
0
        private void webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            if (webBrowser.Document == null)
                return;
            txtUrl.Text = webBrowser.Url.ToString();
            txtCookies.Text = GetCookieString(txtUrl.Text);
            txtUserAgent.Text = GetDefaultUserAgent();
            Regex reg = new Regex(@"(?<=://)([\w-]+\.)+[\w-]+(?<=/?)");
            string domain= reg.Match(txtUrl.Text, 0).Value.Replace("/", string.Empty);

            if (txtUrl.Text.Contains("passport.jd.com"))
            {
                jdlogin(uname, upwd);
            }
            if (txtUrl.Text.Contains("order.jd.com"))
            {
                domain = uname + "_Cookies";
            }
            //if (txtUrl.Text==jdOrderUrl)
            //{
            //    jdBuy();
            //}

            if (reqUrl == txtUrl.Text)
            {
                reqCookies = txtCookies.Text;
            }

            SiteCookies cook = new SiteCookies
            {
                Domain=domain,
                Url=txtUrl.Text,
                Cookies = txtCookies.Text,
                UserAgent = txtUserAgent.Text
            };
            string html = webBrowser.DocumentText;

            new SiteCookiesBll().SaveCookies(cook);
        }
Exemplo n.º 2
0
 public void SaveCookies(SiteCookies cookies)
 {
     new DomainCookiesDb().SaveCookies(cookies);
 }