خرید بک لینک

Vote count: 0

I am really new with AngleSharp. I want to pull some pages behind login form. The first page right after login form works fine, but when I call loadAsync() to load second page, it ask me to login again. I am not sure, but I think the cookie was through away, Anybody meet this case before? Please help!.

since I can't publish the site I am working with, so I use Facebook.com as a sample:

     mConfig = Configuration.Default.WithDefaultLoader().WithCookies().WithLocaleBasedEncoding();
     mContext = BrowsingContext.New(mConfig);
     document = await mContext.OpenAsync("http://facebook.com");

     IHtmlInputElement email = document.QuerySelector("input[name~='email']") as       IHtmlInputElement;
     IHtmlInputElement pass = document.QuerySelector("input[name~='pass']") as IHtmlInputElement;
     IHtmlInputElement btnLogin = document.QuerySelector("input[name~='login'][type~='submit']") as IHtmlInputElement;
     IHtmlFormElement loginForm = document.QuerySelector("form#login_form") as IHtmlFormElement;
     var elements = document.QuerySelectorAll("input");

     if (btnLogin != null && email != null && pass != null)
     {
         email.Value = "[email protected]";
         pass.Value = "secret";
         document = await loginForm.SubmitAsync();

        //Open second page, Facebook ask to login again.
         document = await context.OpenAsync("https://www.facebook.com/jey.san.94/posts/1213295672022614");
     }

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 16 تير 1395 ساعت: 10:02

صفحه بندی