protected void Page_Command(Object sender, CommandEventArgs e)
 {
     if (e.CommandName == "Login")
     {
         if (Page.IsValid)
         {
             bool bValidUser = false;
             try
             {
                 if (Security.IsWindowsAuthentication())
                 {
                     SplendidInit.ChangeTheme(lstTHEME.SelectedValue, lstLANGUAGE.SelectedValue);
                     bValidUser = true;
                 }
                 else
                 {
                     bValidUser = SplendidInit.LoginUser(txtUSER_NAME.Text, txtPASSWORD.Text, lstTHEME.SelectedValue, lstLANGUAGE.SelectedValue);
                 }
             }
             catch (Exception ex)
             {
                 SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                 trError.Visible = true;
                 lblError.Text   = ex.Message;
                 return;
             }
             // 09/12/2006 Paul.  Move redirect outside try/catch to avoid catching "Thread was being aborted" exception.
             if (bValidUser)
             {
                 string sDefaultModule = Sql.ToString(Application["CONFIG.default_module"]);
                 // 10/06/2007 Paul.  Prompt the user for the timezone.
                 if (Sql.IsEmptyString(Session["USER_SETTINGS/TIMEZONE/ORIGINAL"]))
                 {
                     Response.Redirect("~/Users/SetTimezone.aspx");
                 }
                 else if (sDefaultModule.StartsWith("~"))
                 {
                     Response.Redirect(sDefaultModule);
                 }
                 else if (!Sql.IsEmptyString(sDefaultModule))
                 {
                     Response.Redirect("~/" + sDefaultModule + "/");
                 }
                 else
                 {
                     Response.Redirect("~/Home/");
                 }
                 return;
             }
             else
             {
                 trError.Visible = true;
                 lblError.Text   = L10n.Term("Users.ERR_INVALID_PASSWORD");
             }
         }
     }
 }
 protected void lstLANGUAGE_Changed(Object sender, EventArgs e)
 {
     SplendidInit.ChangeTheme(lstTHEME.SelectedValue, lstLANGUAGE.SelectedValue);
     Response.Redirect(Request.RawUrl);
 }