locked
Auto login to websites from WinForms app RRS feed

  • Question

  • I have a requirement where I need to open 3 websites in a browser, from a windows app. These have authentication,I want these sites to logged in when I open the website.I will have the credentials in a config file in Windows application.

    Is it possible to read the controls and post the credentials in the browser(IE)?

    It should be possible as per my knowledge,as it is already been done in QTP and WinRunner.

    Any help would be appreciated.Thanks.


    Ravi
    Wednesday, September 15, 2010 11:26 AM

Answers

  • Hello Ravi,

    You can get started by accessing the WebBrowser.Document property, which gives you an HtmlDocument representing the Web page currently displayed in the WebBrowser control. From that point, you can search through the HTML DOM and find the login related elements (like INPUT) and change their values, etc.

    Of course this is the ideal situation where the login page doesn't have any 'human input checking' features, for example a picture with twisted characters for the users to fill in.

    You also need to reference SHDocVw in your project.

    For HTML & DHTML reference: http://msdn.microsoft.com/en-us/library/ms533050(VS.85).aspx

    If you have further question regarding manipulating the HTML DOM, you may try the Internet Explorer Web Development forum which suites better for this topic (for this is not Windows Forms specific).

    HTH.

    Regards,
    Jie


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    If you have any feedback, please tell us.

    The All-In-One Code Framework Project
    My Blog (in Simplified Chinese)
    • Marked as answer by Jing0 Monday, October 11, 2010 2:35 AM
    Friday, September 17, 2010 8:33 AM

All replies

  • Hello Ravi,

    You can get started by accessing the WebBrowser.Document property, which gives you an HtmlDocument representing the Web page currently displayed in the WebBrowser control. From that point, you can search through the HTML DOM and find the login related elements (like INPUT) and change their values, etc.

    Of course this is the ideal situation where the login page doesn't have any 'human input checking' features, for example a picture with twisted characters for the users to fill in.

    You also need to reference SHDocVw in your project.

    For HTML & DHTML reference: http://msdn.microsoft.com/en-us/library/ms533050(VS.85).aspx

    If you have further question regarding manipulating the HTML DOM, you may try the Internet Explorer Web Development forum which suites better for this topic (for this is not Windows Forms specific).

    HTH.

    Regards,
    Jie


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    If you have any feedback, please tell us.

    The All-In-One Code Framework Project
    My Blog (in Simplified Chinese)
    • Marked as answer by Jing0 Monday, October 11, 2010 2:35 AM
    Friday, September 17, 2010 8:33 AM
  • Depends completely from the webpage, often this is protected.

    If it is old plain HTML it is possible.

    There are enough samples on Internet about this, but use then in your search the used program language.

    There are probably more for Visual Basic then for C++


    Success
    Cor
    Friday, September 17, 2010 8:45 AM