Asp – login page in asp.net

asp.net

hii i am new to web site development
there is a login page in my web site which is in ASP.net(C#.net) . After entering the username and password and user click on the Login button . The user name and password got check and it shows the message at the "the user name and password did'nt match" but i want this messageas a message box. Currently it is showing as a line on the left-top corner of the page..
if possible so please give the code

Best Answer

You would have to put code in the LoginFailed event handler for the login control (if you are using the .NET framework login control, if not, proceed below). The login control's template also has an error label that you would have to inspect the control's children for to hide since you don't want that to display. In LoginFailed, or if you have your own UI login form, you can write out a message to display via:

Page.ClientScript.RegisterStartupScript(this, "error", "alert('The user name and password could not be verified');");