I've already login into....

Topics: Developer Forum, Project Management Forum, User Forum
Jul 29, 2009 at 1:31 PM

Hi

Im very beginner to c#, now use with satisfaction Html agility pack , but in my program i use too:

mshtml.HTMLDocument doc = (mshtml.HTMLDocument)webBrowser1.Document.DomDocument;

to login in reserved area , when i  use :

HtmlAgilityPack.HtmlDocument ParseDoc = web.Load("http://www.sitename.com/admin/table");

ParseDoc is on login page, but i have already login into, can i solve this issue? Need i to read cookie?

thanks and excuse me for my short experience

Massimo

Aug 2, 2009 at 11:05 AM

I have no experience with MSHTML.

Do you know if MSHTML read IE's cookies automatically, or does this have to be done manually?

You can enable cookies with HtmlAgilityPack setting your HtmlWeb object's property UseCookies to true.

/// <summary>
/// Gets or Sets a value indicating if cookies will be stored.
/// </summary>
public bool UseCookies
{
    get;
    set;
}

You need to check them yourself, or create a layer that talks between IE's cookies and HtmlAgilityPack. But I now assume you manually login with Internet Explorer, before starting your application?