protected void _btnLogin_Click(object sender, EventArgs e) { LogonServiceClient _logonService = null; try { _logonService = new LogonServiceClient(); LogonReturnValue returnValue = _logonService.Logon(_txtUsername.Text.Trim(), _txtPassword.Text.Trim()); if (!returnValue.Success) { _lblError.Text = returnValue.Message; return; } if (returnValue.UserType != 1) { _lblError.Text = "Access Denied"; return; } Session[SessionName.LogonId] = returnValue.LogonId; Session[SessionName.MemberId] = returnValue.MemberId; Session[SessionName.DefaultFeeEarner] = returnValue.UserDefaultFeeMemberId; Response.Redirect("~/Pages/Time/AddTimeEntryMobile.aspx"); } catch (System.ServiceModel.EndpointNotFoundException) { _lblError.Text = DataConstants.WSEndPointErrorMessage; _logonService = null; return; } catch (Exception ex) { _lblError.Text = ex.Message; _logonService = null; return; } finally { if (_logonService != null) { if (_logonService.State != System.ServiceModel.CommunicationState.Faulted) { _logonService.Close(); } } } }
protected void _btnLogin_Click(object sender, EventArgs e) { LogonServiceClient _logonService = null; try { _logonService = new LogonServiceClient(); LogonReturnValue returnValue = _logonService.Logon(_txtUsername.Text.Trim(), _txtPassword.Text.Trim()); if (!returnValue.Success) { _lblError.Text = returnValue.Message; return; } if (returnValue.UserType != 1) { _lblError.Text = "Access Denied"; return; } Session[SessionName.LogonId] = returnValue.LogonId; Session[SessionName.MemberId] = returnValue.MemberId; Session[SessionName.DefaultFeeEarner] = returnValue.UserDefaultFeeMemberId; Response.Redirect("~/Pages/Time/AddTimeEntryMobile.aspx"); } catch (System.ServiceModel.EndpointNotFoundException) { _lblError.Text = DataConstants.WSEndPointErrorMessage; _logonService = null; return; } catch (Exception ex) { _lblError.Text = ex.Message; _logonService = null; return; } finally { if (_logonService != null) { if (_logonService.State != System.ServiceModel.CommunicationState.Faulted) _logonService.Close(); } } }
private void DoLogin(string username, string password) { // Block MSH from loggin into FED because it is too well known // Block rekoop integration user as well as it should only be using web services if (username.Trim().ToLower() == "msh" || username.Trim().ToLower() == "rekoop") { _lblError.Text = "Invalid logon details"; return; } _logonService = new LogonServiceClient(); LogonReturnValue returnValue; returnValue = _logonService.Logon(username, password); if (!returnValue.Success) { _lblError.Text = returnValue.Message; return; } Session[SessionName.LogonName] = username; Session["LogonID"] = returnValue.LogonId; if (null == Session[SessionName.ControlSettings]) { PopulateControlPermissions(returnValue.UserType); } Session[SessionName.LogonSettings] = returnValue; if (!string.IsNullOrEmpty(returnValue.WebStyleSheet)) { // This session is used for all kind of operation being done on CSS files Session[SessionName.StyleSheet] = returnValue.WebStyleSheet; // This session is used for security purpose // for instance, if user change the CSS contents, then on click of preview button of ChangeStyle.aspx screen // the new temperory CSS file is created and this CSS is set to Session[SessionName.StyleSheet] // and if user wants to cancel the operation, the Session[SessionName.UserStyleSheet] will set to Session[SessionName.StyleSheet] Session[SessionName.UserStyleSheet] = returnValue.WebStyleSheet; } if (returnValue.UserType == 2) { _clientService = new ClientServiceClient(); bool isMember = true; Guid memOrOrgId = Guid.Empty; if (returnValue.MemberId == IRIS.Law.WebApp.App_Code.DataConstants.DummyGuid) { memOrOrgId = returnValue.OrganisationId; isMember = false; } else { memOrOrgId = returnValue.MemberId; } ClientDetailReturnValue _clientReturnValue = _clientService.GetClientDetail(returnValue.LogonId, memOrOrgId, isMember); Session[SessionName.MemberId] = returnValue.MemberId; Session[SessionName.OrganisationId] = returnValue.OrganisationId; Session[SessionName.ClientRef] = _clientReturnValue.ClientReference; Session[SessionName.ClientName] = _clientReturnValue.Name; } if (returnValue.IsFirstTimeLoggedIn && returnValue.UserType != 1) { Response.Redirect("~/Pages/Password/ForceChangePassword.aspx", true); } if (Session["CurrentPage"] != null) { Response.Redirect(Session["CurrentPage"].ToString()); } else { Response.Redirect("Home.aspx", true); } }
private void DoLogin(string username, string password) { // Block MSH from loggin into FED because it is too well known // Block rekoop integration user as well as it should only be using web services if (username.Trim().ToLower() == "msh" || username.Trim().ToLower() == "rekoop") { _lblError.Text = "Invalid logon details"; return; } _logonService = new LogonServiceClient(); LogonReturnValue returnValue; returnValue = _logonService.Logon(username, password); if (!returnValue.Success) { _lblError.Text = returnValue.Message; return; } Session[SessionName.LogonName] = username; Session["LogonID"] = returnValue.LogonId; if (null == Session[SessionName.ControlSettings]) PopulateControlPermissions(returnValue.UserType); Session[SessionName.LogonSettings] = returnValue; if (!string.IsNullOrEmpty(returnValue.WebStyleSheet)) { // This session is used for all kind of operation being done on CSS files Session[SessionName.StyleSheet] = returnValue.WebStyleSheet; // This session is used for security purpose // for instance, if user change the CSS contents, then on click of preview button of ChangeStyle.aspx screen // the new temperory CSS file is created and this CSS is set to Session[SessionName.StyleSheet] // and if user wants to cancel the operation, the Session[SessionName.UserStyleSheet] will set to Session[SessionName.StyleSheet] Session[SessionName.UserStyleSheet] = returnValue.WebStyleSheet; } if (returnValue.UserType == 2) { _clientService = new ClientServiceClient(); bool isMember = true; Guid memOrOrgId = Guid.Empty; if (returnValue.MemberId == IRIS.Law.WebApp.App_Code.DataConstants.DummyGuid) { memOrOrgId = returnValue.OrganisationId; isMember = false; } else { memOrOrgId = returnValue.MemberId; } ClientDetailReturnValue _clientReturnValue = _clientService.GetClientDetail(returnValue.LogonId, memOrOrgId, isMember); Session[SessionName.MemberId] = returnValue.MemberId; Session[SessionName.OrganisationId] = returnValue.OrganisationId; Session[SessionName.ClientRef] = _clientReturnValue.ClientReference; Session[SessionName.ClientName] = _clientReturnValue.Name; } if (returnValue.IsFirstTimeLoggedIn && returnValue.UserType != 1) { Response.Redirect("~/Pages/Password/ForceChangePassword.aspx", true); } if (Session["CurrentPage"] != null) { Response.Redirect(Session["CurrentPage"].ToString()); } else { Response.Redirect("Home.aspx", true); } }