远程服务器返回错误:(403)Forbidden C#

时间:2016-09-01 05:37:27

标签: c# asp.net gmail

我正在尝试使用谷歌登录 在谷歌请求期间我收到此错误消息。 请查看图片。

#region[Gmail]
        GoogleConnect.ClientId = "xx96534777-h4ld79385m07045pkmf968b0s9fgrjka.apps.googleusercontent.com";
        GoogleConnect.ClientSecret = "8Qr8b-u7jpTDU83binkFRfbj";
        GoogleConnect.RedirectUri = Request.Url.AbsoluteUri.Split('?')[0];


        if (!string.IsNullOrEmpty(Request.QueryString["code"]))
        {
            string code = Request.QueryString["code"];
            string json = GoogleConnect.Fetch("me", code);
            GoogleProfile profile = new JavaScriptSerializer().Deserialize<GoogleProfile>(json);

            lblGmailName.Text = profile.DisplayName;
            lblGmailEmail.Text = profile.Emails.Find(email => email.Type == "account").Value;
            lblGender.Text = profile.Gender;
            imgGmail.ImageUrl = profile.Image.Url;
            pnlProfile.Visible = true;
            //byte[] bytes = new System.Net.WebClient().DownloadData(GoogleProfile.profile);
            string ProfileImage = imgGmail.ImageUrl;
            EmailId = lblGmailEmail.Text;
            UserName = lblGmailName.Text;
            Gender = lblGender.Text;

            }

0 个答案:

没有答案