Login to website?

Hi group,

This is a complete first for me and I have no idea where to start looking...

I need to retrieve data from a php website. This website requires a login. So before it's possible to retrieve data I need to login :-)

I need to use the HTTP POST method, most likely because in the source of the url I found this:
<tr><td class="menu_cell_repeater"><form action="login.php" method="post">
So how do I go about that
I need to supply the URL + credentials.

I've been searching and found the WebClient class with the Openstream method is that the correct way to go

Any help is greatly appreciated.

Regards,

Sander
PS: This post is (at this point ) for personal reasons but this will certainly be required at work :-)



Answer this question

Login to website?

  • Will Pearson - MVP

    PS: I'm using VS2003(!!)

  • DW5000

    Hai Da

    Are you asking for any security issues or something else.





  • misterEd

    If I were doing this I would use the windows forms WebBrowser control. Using the control you can navigate to the login page, use the javascript DOM to access the form controls, enter the username/password (Webbrowser.document.getElementById('usernametext').value = "username"), call post (WebBrowser.document.forms(0).submit()), navigate to the desired page and then read the html of the page (WebBrowser.innerHtml).

    Using the method you are leaning to would require you to collect and send the authentication cookie yourself.

    Whatever method you use good luck.

  • Macrap

    Nothing illegal!! As I said this is for personal reasons....but if it's possible I could use this for my work.

    Regards,

    S

  • Ensign Joe

    I'll give it a go! Thnx!

  • Login to website?