Auto fill and submit another site

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • offlineplanet
    New Member
    • Feb 2010
    • 6

    Auto fill and submit another site

    I want to access some site , say gmail or twitter from my application. The application should fill my username and password and submit the form and post some updates from the application itself. Here is some code . Help would be appreciated


    Code:
    protected void Button1_Click(object sender, EventArgs e)
    {
    Object obj = null;
    Object URL = "www.gmail.com";
    InternetExplorer iexp = new InternetExplorer();
    iexp .Visible = true;
    iexp .Navigate2(ref URL, ref obj , ref obj , ref obj , ref obj );
    //iexp .Navigate("http://www.gmail.com", ref obj , ref obj , ref obj , ref obj );
    
    while (iexp .Busy)
    {
    System.Threading.Thread.Sleep(50);
    }
    
    mshtml.HTMLDocumentClass dclass = (mshtml.HTMLDocumentClass)iexp .Document;
    
    
    mshtml.HTMLInputElementClass eclass= (mshtml.HTMLInputElementClass)dclass.all.item("email", null);
    eclass.value = "username";
    
    
    eclass= (mshtml.HTMLInputElementClass)dclass.all.item("Passwd", null);
    eclass.value = "password";
    
    eclass= (mshtml.HTMLInputElementClass)dclass.all.item("signIn", null);
    eclass.click; 
    }
    --------------------------------------------------------------------------

    at line -
    mshtml.HTMLDocu mentClass dclass = (mshtml.HTMLDoc umentClass)iexp .Document;

    i am receiving an error - "Error HRESULT E_FAIL has been returned from a call to a COM component."
    Last edited by tlhintoq; Feb 22 '10, 10:50 AM. Reason: [CODE] ...Your code goes between code tags [/CODE]
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.

    Comment

    • offlineplanet
      New Member
      • Feb 2010
      • 6

      #3
      I got it .... next time i'll do it with code tags. But can anyone help me out with teh question i have posted ??

      Comment

      • semomaniz
        Recognized Expert New Member
        • Oct 2007
        • 210

        #4
        I believe the error that you are referring to is related to permission. Check your IIS policy

        Comment

        Working...