Asp Net Login Control Error Message
Contents |
ASP.NET Community Standup Forums Help Home/ASP.NET Forums/General ASP.NET/Web how to show error message in asp net Forms/Customize the login error message Customize the login error display error message c# asp net message [Answered]RSS 10 replies Last post Feb 16, 2012 10:44 AM by zhshqzyc how to display error message in asp net using c# ‹ Previous Thread|Next Thread › Print Share Twitter Facebook Email Shortcuts Active Threads Unanswered Threads Unresolved Threads Support Options Advanced Search
Asp Net Login Control Connect To Database
Related Links GuidanceSamplesVideos Reply zhshqzyc Member 181 Points 588 Posts Customize the login error message Feb 09, 2012 08:53 AM|zhshqzyc|LINK Hello when I login and get an error "Your login attempt was not successful. Please try again." How can I customize the error? asp net login control tutorial Suppose I use asp.net membership provider. Thanks. Reply avinash_bhud... Participant 1885 Points 510 Posts Re: Customize the login error message Feb 09, 2012 09:06 AM|avinash_bhudke|LINK You can give custom message on myLogin_LoginError event. protected void myLogin_LoginError(object sender, EventArgs e) Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to Get Help Ask a Question Ask for Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time https://www.experts-exchange.com/questions/26602328/Asp-net-Login-control-customize-error-message.html Job Ways to Get Help Expand Search Submit Close Search Login Join Today http://www.aspnetbook.com/apps/design_secure_application_login_control.php Products BackProducts Gigs Live Careers Vendor Services Groups Website Testing Store Headlines Experts Exchange > Questions > Asp.net Login control customize error message Want to Advertise Here? Solved Asp.net Login control customize error message Posted on 2010-11-09 ASP.NET JavaScript Web Languages/Standards-Other 1 Verified Solution 8 Comments 1,023 Views Last Modified: 2012-05-10 I am asp net trying to customize the login control so when the user enters a bad username or password it will show a message in the label below, the problem is that this is not firing up, and instead the page is refreshed (when incorrect login info is entered and I see asp.net " message Error authenticating user. Logon failure: unknown user name or bad password" How can I asp net login show a pop up java message or at least tell my label to show the error? I am using the following event but doesnt seem to work? any ideaS? Protected Sub Login1_LoginError(ByVal sender As Object, ByVal e As System.EventArgs) Handles Login1.LoginError 'There was a problem logging in the user 'Display the failure message in a client-side alert box ClientScript.RegisterStartupScript(Me.GetType(), "LoginError", _ String.Format("alert('{0}');", Login1.FailureText.Replace("'", "\'")), True) 'See if this user exists in the database Dim userInfo As MembershipUser = Membership.GetUser(Login1.UserName) If userInfo Is Nothing Then 'The user entered an invalid username... lblLoginErrorDetails.Text = "There is no user in the database with the username " & Login1.UserName Else 'See if the user is locked out or not approved If Not userInfo.IsApproved Then lblLoginErrorDetails.Text = "Your account has not yet been approved by the site's administrators. Please try again later..." ElseIf userInfo.IsLockedOut Then lblLoginErrorDetails.Text = "Your account has been locked out because of a m Learn ASP.NET Visual Studio ASP.NET App Design ASP.NET Web Server ASP.NET Secure App Learn HTML HTML Basics HTML Advanced HTML Forms HTML Standards Learn HTML5 HTML5 Basics HTML5 Tags Learn CSS CSS Styling CSS Advanced ASP.NET Styling ASP.NET Image Effects Learn SQL SQL Basics SQL Reference Previous Chapter Next Chapter ASP.NET 2.0’s new Login control provides you with a more convenient way to let the users of your application log in to you application. The Login control should be placed in a page called Login.aspx unless you changed the default
{
// Determine why the user could not login...
myLogin.FailureText = "Your login attempt was not successful. Please try again.";
// Does there exist a User account for this user?
MembershipUser usrInfo = Membership.GetUser(myLogin.UserName);
if (usrInfo != null