0

I am trying to create a simple app to retrieve my contacts from my GMail account. The code pasted below works fine when I run it from my desktop in VS.NET, but when I publish the ASP.NET page to a web server it fails with an authentication error.

Can anyone make a suggestion and/or point me at an example?

John.

protected void Page_Load(object sender, EventArgs e) {
      GoogleContactService.InitializeService("gmailaccount", "password");
      ListAllContacts();
}

private void ListAllContacts() {
      DataTable dt = new DataTable();
      dt.Columns.Add(new DataColumn("Name"));
      dt.Columns.Add(new DataColumn("Email"));
      dt.Columns.Add(new DataColumn("Phone"));
      dt.Columns.Add(new DataColumn("Details"));

      foreach (ContactDetail contact in GoogleContactService.GetAllContact())
      {
        dt.Rows.Add(contact.Name,
            contact.EmailAddress1,
            contact.Phone,
            contact.Details);
      }

      gmailContactsGrid.DataSource = dt;
      gmailContactsGrid.DataBind();
}
ethorn10
  • 1,889
  • 1
  • 18
  • 29
  • Can you post the error and which line is triggering it? – Zerkey Oct 23 '13 at 02:11
  • Invalid credentials Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: Google.GData.Client.InvalidCredentialsException: Invalid credentials – user2909427 Oct 23 '13 at 02:17
  • Well [this post](http://stackoverflow.com/questions/13551525/google-contact-api-error) uses java but mentions that you cannot use your normal password, and that google will send an xml response explaining the failure. The only other thing I can think of is that the request is originating from an IP address that google has never seen, and they deny it. – Zerkey Oct 23 '13 at 02:21

0 Answers0