Click here to Skip to main content
15,896,154 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to display an error message on my login page if the user enters invalid credentials.

Can anyone help me with that?
Posted
Updated 21-Jan-11 4:13am
v3
Comments
Nish Nishant 21-Jan-11 10:13am    
Added ASP.NET tag.

This is really basic ASP.NET. Start here: http://msdn.microsoft.com/en-us/library/ms178331(v=VS.90).aspx[^]
 
Share this answer
 
I won't give any link for this question but steps for you to try.

Steps:
1. Keep a label with Visibility as false on your page (you can place it somewhere below login button)
2. On login button click, check for login credentials. If found wrong then set the visibility of the label true and set the text of that label.

Try!
 
Share this answer
 
Comments
RKT S 21-Jan-11 10:21am    
thanks Sandeep..it works..:)
Sandeep Mewara 21-Jan-11 10:35am    
Your welcome. Had fun implementing it? Take step-by-step and you will learn and enjoy. :)
hey,
you can register a client script after the login button is pressed. and show a javascript alert message.

e.g.
if (Validated)
{
//do stuff;
}
else
{
ScriptManager.RegisterClientScriptBlock(Me.Page, Me.GetType(), "ShowError", "return InvalidLogin();", True)
}




and in the markup of your page add the script

<script type="text/javascript">
function InvalidLogin()
{
alert("Invalid username or password");
return false;
}



best of luck
Ahsan Sarfraz
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900