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();
}