使用Gmail帐户登录时,我收到了无效的凭据 [英] While Login With Gmail Account I Am Getting The Invalid Credentials
本文介绍了使用Gmail帐户登录时,我收到了无效的凭据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td>
User Name:<asp:TextBox ID="txtUserName" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Password:<asp:TextBox ID="txtPassword" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnSubmit" Text="Get Gmail Contacts List" runat="server"
onclick="btnSubmit_Click" />
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblstatus" runat="server"></asp:Label>
</td>
<td></td>
</tr>
<tr>
<td colspan="2">
<asp:GridView ID="GridView1" runat="server" Width="100%">
</asp:GridView>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Google.Contacts;
using Google.GData.Contacts;
using Google.GData.Client;
using Google.GData.Extensions;
using System.Data;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
DataSet ds = new DataSet();
ds.Tables.Add("GmailContacts");
ds.Tables[0].Columns.Add("EmailId");
RequestSettings rs = new RequestSettings("Idea Elan2", txtUserName.Text, txtPassword.Text);
rs.AutoPaging = true;
ContactsRequest cr = new ContactsRequest(rs);
Feed<Contact> f = cr.GetContacts();
foreach (Contact contact in f.Entries)
{
foreach (EMail email in contact.Emails)
{
DataRow row = ds.Tables[0].NewRow();
row["EmailId"] = email.Address.ToString();
ds.Tables[0].Rows.Add(row);
}
}
GridView1.DataSource = ds.Tables[0];
GridView1.DataBind();
lblstatus.Text = "Total Contacts For" + txtUserName.Text + ":" + ds.Tables[0].Rows.Count.ToString();
}
}
foreach(f.Entries中的联系方式)在这里它自我我得到错误你可以请求这是问题和错误是无效的凭证
在先谢谢
foreach (Contact contact in f.Entries) here it self i am getting error can u please sove this is Issue and the error is Invalid Credentials
Thanks in Advance
推荐答案
试试这个链接给出的解决方案。
http://www.aspsnippets.com/Articles/Import-Contacts -from-Google-Gmail-Account-in-ASPNet-using-C-and-VBNet.aspx [ ^ ]
希望这有帮助!! :) :)
问候,
Praneet
Hi,
Try out the solution given on this link.
http://www.aspsnippets.com/Articles/Import-Contacts-from-Google-Gmail-Account-in-ASPNet-using-C-and-VBNet.aspx[^]
Hope this helps !! :) :)
Regards,
Praneet
这篇关于使用Gmail帐户登录时,我收到了无效的凭据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文