forum

home / developersection / forums / how to change failure text for two different possibilities?

How to change Failure text for two different possibilities?

Anonymous User 2152 08-Dec-2014

I have ASP Login Control in my page and a 

<asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal>

What I want to do is that when I perform authentication in 

protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
    DAL = new DataAccessLayer();
    conObj = DAL.openConnection();
    string query = "SELECT * FROM tblUser WHERE UEmail = '"+Login1.UserName+"'"; 
    SqlDataReader SQLDR = DAL.ExecuteQueryReturnValue(query); 
    if (SQLDR.Read())
    {
        if (SQLDR["UPassword"].ToString() == Login1.Password.ToString())
        { 
            Session["userName"] = SQLDR["UEmail"].ToString();
            e.Authenticated = true;
        }
        else {
            // Change the 'FailureText' to "password is incorrect"
            e.Authenticated = false;
        } 
    }
    else
    {
        // Here I want to change the 'FailureText' to "User does not exists"
        e.Authenticated = false;
    }
   }

set the text of FailureText to 

"Incorrect Password"

Or set to

"User does not exist"

for both possibilities.


Updated on 09-Dec-2014

I am a content writter !


Message
Can you answer this question?

Answer

2 Answers

Liked By