نمایش نتایج 1 تا 2 از 2

نام تاپیک: ورود به سایت با گوگل

  1. #1
    کاربر دائمی آواتار Mohammad_dn
    تاریخ عضویت
    اردیبهشت 1392
    محل زندگی
    نوده سیتی
    پست
    990

    Angry ورود به سایت با گوگل

    سلام من میخوام با گوگل تو سایتم لوگ این کنم..تنها مشکلی که هست اینه که وقتی به سایت بر میگرده خطای زیر رو میده:
    Cannot convert object of type 'System.String' to type '?2?.?3?.?5?'

    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: System.InvalidOperationException: Cannot convert object of type 'System.String' to type '?2?.?3?.?5?'

    Source Error:

    Line 1175: string code = Request.QueryString["code"];
    Line 1176:
    Line 1177: string json = GoogleConnect.Fetch("me", code);
    Line 1178: GoogleProfile profile = new JavaScriptSerializer().Deserialize<GoogleProfile>( json);
    Line 1179: GoogleConnect.Clear(Request.QueryString["code"].ToString());



    کد مربوط به لوگ این:


    [HttpGet]
    [Route("LoginGoogle")]
    public void LoginGoogle()
    {
    GoogleConnect.ClientId = "482352026499-51empr7iklqakhf4d1tjpkr0uj5lhdj4.apps.googleuserco ntent.com";
    GoogleConnect.ClientSecret = "7FwT1OefVxpofym32R3fL0td";

    GoogleConnect.RedirectUri = "http://localhost:8089";

    if (!string.IsNullOrEmpty(Request.QueryString["code"]))
    {
    string code = Request.QueryString["code"];

    string json = GoogleConnect.Fetch("me", code);
    GoogleProfile profile = new JavaScriptSerializer().Deserialize<GoogleProfile>( json);
    GoogleConnect.Clear(Request.QueryString["code"].ToString());
    string name = profile.DisplayName;
    string Email = profile.Emails.Find(email => email.Type == "account").Value;
    SysAction.User us = new SysAction.User();
    if (us.GetIsEmail(Email) == false)
    {
    Response.Write("<script>alert('این ایمیل قبلا ثبت شده است');location='/Login';</script>");

    }
    else if (us.GetIsEmail(Email, true) == false)
    {

    FormsAuthentication.RedirectFromLoginPage(Email, false);
    }
    else
    {
    if (us.SaveUser(Email, "", Email, name, 0, "", true) == true)
    {

    FormsAuthentication.RedirectFromLoginPage(Email, false);
    }
    else
    {
    Response.Write("<script>alert('خطا');location='/Login';</script>");
    }

    }
    }
    if (Request.QueryString["error"] == "access_denied")
    {
    Response.Write("<script>alert('خطا');location='/Login';</script>");
    }
    }
    private class GoogleProfile
    {
    public string Id { get; set; }
    public string DisplayName { get; set; }
    public List<Email> Emails { get; set; }
    public string Gender { get; set; }
    }

    private class Email
    {
    public string Value { get; set; }
    public string Type { get; set; }
    }




  2. #2
    کاربر دائمی آواتار Mohammad_dn
    تاریخ عضویت
    اردیبهشت 1392
    محل زندگی
    نوده سیتی
    پست
    990

    نقل قول: ورود به سایت با گوگل

    مشکل حل شد

تاپیک های مشابه

  1. ورود به سایت با اکانت گوگل
    نوشته شده توسط xsbehx در بخش ASP.NET Web Forms
    پاسخ: 2
    آخرین پست: چهارشنبه 23 دی 1394, 15:40 عصر
  2. ورود به سايت با امنيت بالا (Login)
    نوشته شده توسط morteza_naderloo در بخش PHP
    پاسخ: 3
    آخرین پست: یک شنبه 04 دی 1390, 15:57 عصر
  3. سوال: ورود به سایت با Enter
    نوشته شده توسط iman65 در بخش PHP
    پاسخ: 3
    آخرین پست: چهارشنبه 26 خرداد 1389, 09:49 صبح
  4. ورود به سایت با استفاده از Username و Password در کامپوننت HTML
    نوشته شده توسط FiACKER در بخش توسعه نرم افزار تحت وب
    پاسخ: 6
    آخرین پست: پنج شنبه 19 آذر 1388, 22:29 عصر
  5. عدم توانایی ورود به سایت با ID اصلی
    نوشته شده توسط mohammad_272005 در بخش گفتگو با مسئولین سایت، درخواست و پیشنهاد
    پاسخ: 1
    آخرین پست: پنج شنبه 21 آذر 1387, 08:43 صبح

قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •