I have been attempting to use ASP.NET MVC remote validation for username login access to return both a string and a boolean. If I return just a string, it will assume a boolean of false and not let the user submit the form. Is there a way I could pass in both true and a string such as "[USERNAME] is available!"?
Current method:
public JsonResult isUserAvailable(string username)
{
if (Membership.GetUser(username) == null)
{
return Json(String.Format(CultureInfo.InvariantCulture, "<strong style='color: green;'>{0} is available!</strong>",
username), JsonRequestBehavior.AllowGet);
}
else
{
return Json(false, JsonRequestBehavior.AllowGet);
}
}