protected void btnlogin_Click(object sender, EventArgs e) { IUnityContainer container = new UnityContainer(); UnityConfigurationSection section = (UnityConfigurationSection)ConfigurationManager.GetSection("unity"); section.Configure(container); IEngineerBL eservice = container.Resolve <IEngineerBL>(); ICustomerBL cservice = container.Resolve <ICustomerBL>(); if (eservice.validateEngineer(txtbenutzername.Value, txtpasswort.Value) >= 0) { Response.Redirect("~/InstallationList.aspx?user=engineer&userid=" + eservice.validateEngineer(txtbenutzername.Value, txtpasswort.Value)); } else if (cservice.validateCustomer(txtbenutzername.Value, txtpasswort.Value) >= 0) { Response.Redirect("~/InstallationList.aspx?user=customer&userid=" + cservice.validateCustomer(txtbenutzername.Value, txtpasswort.Value)); } else { loginresponse.InnerText += "Falscher Benutzername bzw. Passwort"; } }
public override void Validate(string userName, string password) { try { if (userName == null || password == null) { throw new ArgumentNullException(); } IUnityContainer container = new UnityContainer(); UnityConfigurationSection section = (UnityConfigurationSection)ConfigurationManager.GetSection("unity"); section.Configure(container); IEngineerBL rservicebl = container.Resolve <IEngineerBL>(); if (rservicebl.validateEngineer(userName, password) >= 0) { throw new FaultException("Incorrect Username or Password"); } } catch (Exception exp) { log.Error("Fehler bei Validierung des Engineers via Soap."); throw new Exception("Fehler bei Validierung des Engineers via Soap.", exp); } }