Beispiel #1
0
    protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
    {
        BALLogin bllog = new BALLogin();
        DALLogin dllog = new DALLogin();

        try
        {
            if (Login1.UserName.Trim().ToString() == "" || Login1.Password.Trim().ToString() == "")
            {
                e.Authenticated = false;
            }

            bllog.EmailId  = Login1.UserName.Trim().ToString();
            bllog.Password = Login1.Password.Trim().ToString();

            AgentDTO agent = dllog.AgentLogin(bllog);
            if (agent != null)
            {
                Session.Add("UserName", agent.AgentName);
                Session.Add("UserCode", agent.AgentId);
                Session.Add("AgentMailId", Login1.UserName.Trim().ToString());
                Session.Add("Password", Login1.Password.Trim().ToString());
                Response.Redirect("SearchProperty.aspx?Aid=" + agent.AgentId.ToString() + " ");
            }
        }
        catch (Exception exp)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "Showstatus", "javascript:alert('" + exp.Message + "')", true);
            throw exp;
        }
    }