Could not login to specificed site using webbrowser control RRS feed

  • Question

  • I have created an silverlight  application in which remote service will do like a Crawler to take data from specificed site, to be able to take data i need to login into the site, "sign-in" needs to use a webbrowser control then push information about credential for sign-in to the site. Everthing worked well on my PC both in modes of Debug or deployed on iis (Windows 7) . But when deploying on Windows Server 2008, "Sign-in" has never been response when i make Invoke on "Click" button to login to the site.

    if ((textMDP != null& (btnOK != null))

    Thanks for your help.


    • Moved by Leo Liu - MSFT Monday, March 14, 2011 3:36 AM Off-topic, moved for better support. (From:Visual C# General)
    Thursday, March 10, 2011 9:20 AM

All replies

  • Welcome to the MSDN forum.
    As you’ve said that your project works normally on your own PC but abnormally on Windows Server2008, so I think there is not any code-logic-related error, there may be some security, authority or other aspects related work you should do. Add try…catch block in your code to test if any exception will be thrown, in order to find the criminal specifically.
    I think you should make clear if the problem is got in your Silverlight app or it is caused by the WebBrowser control but without relation to the Silverlight app.
    For different causes, please choose one of these forums to post your thread in it for better support, Silverlight Forum
    | Windows Forms General, then I will move your thread into the Off-Topic forum shortly.
    Otherwise, please post more code snippets for our friends here to reproduce your issue. Thanks for your understanding.

    Leo Liu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Saturday, March 12, 2011 9:29 AM
  • Thanks Leo,

    I have added more try..catch and aslo added more log but actually i did not get any exception, as i mentioned previously, it seems like that

    when execution step into line "btnOK.InvokeMember("Click");" and was being hang at here, no response returned,

                        _IsNavigateCompleted = false;
                        while (!_IsNavigateCompleted)

    The statement of   while (!_IsNavigateCompleted) has never been called although it should be(async in this case). I aslo looking forward for stepping into event: "Navigated" but never.

     void webBrowser_DocumentCompleted(object senderWebBrowserDocumentCompletedEventArgs e)
                if (webBrowser.ReadyState == WebBrowserReadyState.Complete)
                    _IsNavigateCompleted = true;

    I also think of that are the problem of security, authority...only on setting of iis of windows server 2008, but i was not still find out yet what is the problem here?

    I am sure that the problem is not related to Silverlight, this aslo happended on application hosted webbrowser control that deployed on Windows Server 2008.


    Monday, March 14, 2011 2:07 AM
  • Hi Guys,

    I have the same issue. It seems the method InvokeMember("Click") does not work. 

    The case as follow: 

    step1: using WebBrowser control to navigate the login page.

    step2: fill in the fields necessary then call InvokeMember("Click") for the submit button.

    step3. Awaiting until the event DocumentCompleted raised and I print out the Html content of WebBrowser document (WebBrowser.Document.Body.InnerHtml).

    step4. Using Internet Explorer to login the page. and compare the source HTML of the response page with the WebBrowser document content. Unfortunately, they are difference (They are similar when I run in Debug mode from visual studio) . 


    Any experts show me why?

    Thank you in advance

    Monday, March 14, 2011 2:55 AM
  • Thankyou,Best Regards
    windows mobile
    Thursday, June 30, 2011 9:00 AM
  • Did anyone get to the bottom of this?? - I have exactly the same issue.

    I developed a windows service in C# that automates logging into a website via the webbrowser control.

    I developed it  in VS 2010 on Windows 7 and Ive debuged it and installed it on my Windows 7 client and it works fine. The service is still running on my windows 7 machine fine.

    I am now putting it onto a Windows 2008 server and are experiencing the same problem as above. The code just hangs on the click statement

    (I have debug logging either side)


    I can see the outerhtml of the html doc so its got to the page ok and there is exception handling round the statement.

    The only difference is Windows 7 to Windows 2008 Server

    Any help appreciated


    Friday, January 13, 2012 4:56 PM
  • I've had the same issue, after several tries, we found out that if the user under which the service is running as is logged on to the application server, the code works fine but when the user is not logged in, it doesnt work. Could you please let me know if you found a resolution to this or a way to bypass the above mentioned problem?



    Thursday, February 23, 2012 2:56 PM
  • Try to add this line after initializing the WebBrowser object:

    webBrowser1.ScriptErrorsSuppressed = true;

    I think your issue will be solved. The reply of (Leo Liu - MSFT) helped me know the solution of this issue which I have also faced.

    Tuesday, February 3, 2015 6:58 PM