MSDN > Home page del forum > Visual C# General > How to login without webbrowser
Formula una domandaFormula una domanda
 

Con rispostaHow to login without webbrowser

  • mercoledì 4 novembre 2009 20.30yterbium Medaglie utenteMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utente
     Contiene codice
    Hi everyone,

    I am trying to log in one site (with valid login and password) but I dont want to use webbrowser control in my app. this would work nice with webbrowser:
    void PrihlasPoNacitani(object sender, WebBrowserDocumentCompletedEventArgs e)
            {
                HtmlElementCollection elements = webBrowser1.Document.GetElementsByTagName("input");
                foreach (HtmlElement element in elements)
                {
                    if (element.Name == "username")
                    {
                        element.SetAttribute("value", meno);
                    }
                    if (element.Name == "password")
                    {
                        element.SetAttribute("value", heslo);
                    }
                    if (element.Name == "login")
                    {
                        element.InvokeMember("click");
    
                    }
                }
            }
    

    So is there any way how to do this without webbrowser. I can get automatically the source code of web page , but how to put and send my password and login into "input" type?

    thanks for answers

Risposte

  • giovedì 5 novembre 2009 8.53yterbium Medaglie utenteMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utente
     Con risposta
    sorry, I have formed it wrong...


    But what I wanted was that the webBrowser should not be in my app.

    So I figure it out, that I do not insert webbrowser into [design] view, but just do an instance in code like webBrowser web = new webBrowser()...

    It was late nigh yesterday, that was the problem probably.

    Sorry to bother you :-)

Tutte le risposte

  • mercoledì 4 novembre 2009 23.00K.MAK Medaglie utenteMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utente
     
    Not sure what do you want to do?

    If the post is helpful or answers your question, please mark it as such!
  • giovedì 5 novembre 2009 8.53yterbium Medaglie utenteMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utente
     Con risposta
    sorry, I have formed it wrong...


    But what I wanted was that the webBrowser should not be in my app.

    So I figure it out, that I do not insert webbrowser into [design] view, but just do an instance in code like webBrowser web = new webBrowser()...

    It was late nigh yesterday, that was the problem probably.

    Sorry to bother you :-)
  • giovedì 5 novembre 2009 14.54Athar Medaglie utenteMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utente
     
    thats good to at least share how to login without web browser,

    I know now :)
    Regards, Athar
  • lunedì 9 novembre 2009 17.06Athar Medaglie utenteMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utente
     
    Hi Yterbium,

    Could you mark your post as a answer so people know that you have solved your problem?

    cheers :)
    Regards, Athar