Reputation: 3077
Maybe the question sounds silly. Who is the provider,in the above statement? Is it the programmer who provides the error needed,the user that creates a membership or someone else? Specifically, i want to show error when the user types more than the maxlength characters as below: ps. find the line with * in the geterrormessage method...
UsernameTextbox.MaxLength = 15;
if (UsernameTextbox.Text.Length > UsernameTextbox.MaxLength)
{
status = MembershipCreateStatus.ProviderError;
Msg.Text = GetErrorMessage(status);
}
public string GetErrorMessage(MembershipCreateStatus status)
{
switch (status)
{
case MembershipCreateStatus.DuplicateUserName:
return "Username already exists. Please enter a different user name.";
case MembershipCreateStatus.DuplicateEmail:
return "A username for that e-mail address already exists. Please enter a different e-mail address.";
case MembershipCreateStatus.InvalidPassword:
return "The password provided is invalid. Please enter a valid password value.";
case MembershipCreateStatus.InvalidEmail:
return "The e-mail address provided is invalid. Please check the value and try again.";
case MembershipCreateStatus.InvalidAnswer:
return "The password retrieval answer provided is invalid. Please check the value and try again.";
case MembershipCreateStatus.InvalidQuestion:
return "The password retrieval question provided is invalid. Please check the value and try again.";
case MembershipCreateStatus.InvalidUserName:
return "The user name provided is invalid. Please check the value and try again.";
//****** STAR LINE:i want to show the following message but i don't know if the-->
//-->the provider error method can let me do this
case MembershipCreateStatus.ProviderError:
return "field outreached the maximum length of characters which is:";
case MembershipCreateStatus.UserRejected:
return "The user creation request has been canceled. Please verify your entry and try again. If the problem persists, please contact your system administrator.";
default:
return "An unknown error occurred. Please verify your entry and try again. If the problem persists, please contact your system administrator.";
}
}
Upvotes: 1
Views: 2028
Reputation: 813
The Authentication Provider "AspNetSqlMembershipProvider" returns an error.
For more info http://go.microsoft.com/fwlink/?LinkID=177550
Upvotes: 0
Reputation: 6077
The Provider is the default MembershipProvider which is built in. You can specify your own implementation by creating a class which derives from MembershipProvider.
Take a look at this tutorial on the MSDN: http://msdn.microsoft.com/en-us/library/yh26yfzy.aspx
Upvotes: 1