The remote server returned an error: (403) Forbidden

Mehrdad ilchizadeh asked on December 5, 2015 16:14

Hello, i need loging by google in my site.. i Create custom webpart.. work good but when back from google in my site i have erorr 403.. thi url: /Special-Page/Register?state=/profile&code=4/-UPecnpcPdMSoX2miCLuhBiIY65MkyxNaeTIW_AQXlI#

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

Recent Answers


Roman Hutnyk answered on December 5, 2015 20:18

I'd recommend you to take approach described in documentation to handle external authentication. See this for details.

2 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.