protected void btnLogin_Click(object sender, EventArgs e) { try { model = new clsUserDetailsModel(); model = businessLayer.Login(txtEmail.Text.Trim(), txtPassword.Text.Trim(), UserType.AdminStaff); if (model == null || model.iUserId == 0) { throw new FormatException("Invalid username and password"); } Session["Customer"] = model; Response.Redirect("~/WebForms/Sale/Sales.aspx", false); } catch (FormatException ex) { pnlError.Visible = true; lblError.Text = ex.Message; } catch (Exception ex) { Response.Redirect(string.Format("Error.aspx?stat={0}", (int)ErrorStatus.LoginFail)); } }