コード例 #1
0
        protected void btn_Click(object sender, EventArgs e)
        {
            //We need to get user's selected provider enumerator.
            PROVIDER_TYPE selectedProvider = (PROVIDER_TYPE)Enum.Parse(typeof(PROVIDER_TYPE), ((Button)sender).Text.ToUpper());

            //Initialize User
            SocialAuthUser objUser = new SocialAuthUser(selectedProvider);

            //Call Login
            objUser.Login(returnUrl:"ManualLogin.aspx");
            //Login method also accepts a parameter for URL to which user should be redirected after login. If not specified,
            //automatically defaultUrl as set in Web.Config will be picked for redirection.
        }
コード例 #2
0
ファイル: DoCommand.cs プロジェクト: fizikci/Cinar
        private void socialAuthLogin()
        {
            try
            {
                PROVIDER_TYPE selectedProvider = (PROVIDER_TYPE)Enum.Parse(typeof(PROVIDER_TYPE), context.Request["provider"].ToUpperInvariant());

                //Initialize User
                SocialAuthUser objUser = new SocialAuthUser(selectedProvider);

                //Call Login
                objUser.Login(returnUrl: "loginBySocialAuth.ashx");
            }
            catch (Exception ex)
            {
                context.Response.Write(ex.Message + (ex.InnerException != null ? " (" + ex.InnerException.Message + ")" : ""));
            }
        }