ASP.NET C# Writting a string into html to validate ?
- by Yardstermister
I am pretty new to ASP.NET and C# I have spent the day learning the basics of the ASP.NET Membership provider I have built all my validator but are getting stuck at outputting my error message on the page.
private void LogCreateUserError(MembershipCreateStatus status, string username)
{
string reasonText = status.ToString();
switch (status)
{
case MembershipCreateStatus.DuplicateEmail:
case MembershipCreateStatus.DuplicateProviderUserKey:
case MembershipCreateStatus.DuplicateUserName:
reasonText = "The user details you entered are already registered.";
break;
case MembershipCreateStatus.InvalidAnswer:
case MembershipCreateStatus.InvalidEmail:
case MembershipCreateStatus.InvalidProviderUserKey:
case MembershipCreateStatus.InvalidQuestion:
case MembershipCreateStatus.InvalidUserName:
case MembershipCreateStatus.InvalidPassword:
reasonText = string.Format("The {0} provided was invalid.", status.ToString().Substring(7));
break;
default:
reasonText = "Due to an unknown problem, we were not able to register you at this time";
break;
}
//CODE TO WRITE reasonText TO THE HTML PAGE ??
}
What is the best way to output the varible result onto the page as I have relied upon the built in ASP:Validators untill now.