When the LoginError
event fires for the asp:Login
control, how can I find why the error happened?
Is there something like an e.ErrorType
property that tells me why the login was unsuccessful? Or do I have to check everything manually like in this tutorials:
http://www.asp.net/security/tutorials/validating-user-credentials-against-the-membership-user-store-cs or http://www.aspnettutorials.com/tutorials/controls/howto-errors-login-asp4-csharp.aspx
You can use the standard ASP.NET MVC ValidationSummary method to render a placeholder for the list of validation error messages. The ValidationSummary() method returns an unordered list (ul element) of validation messages that are in the ModelStateDictionary object.
The ASPError object is used to display detailed information of any error that occurs in scripts in an ASP page. Note: The ASPError object is created when Server. GetLastError is called, so the error information can only be accessed by using the Server. GetLastError method.
Application level error handling allow to detect or handle web application level error handling so that its helps to handle and solve the particular error. 2. Add a <customErrors> element in web. config file for your web application.
There is no "Out-of-the-box" error type information as far as I've seen in the past for the LoginError
event (although I agree with you that it would be really nice). In fact, in my experience the EventArgs
parameter is always null
for me for that event in the asp:Login
control =/
It's quite possible that someone else is aware of something I'm not, but I think we are all stuck manually determining why the LoginError
occurred for now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With