Example #1
0
        /// <summary>
        /// Handles the Click event of the Login control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Login_Click(object sender, System.EventArgs e)
        {
            try
            {
                UserModel userInfo = userComponent.GetUserInfoByUsernameAndPassword(txtUsername.Value.Trim(), txtPassword.Value.Trim());

                if (userInfo != null && userInfo.Id > 0)
                {
                    // 4. Do the redirect.
                    FormsAuthentication.RedirectFromLoginPage(userInfo.Id.ToString(), false);
                }
                else
                {
                    lblError.Visible = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
                //ErrorLog.LogErrorsToFile(ex.Message);
            }
        }