When all property validation passes but the login info passed in is incorrect, I want to display a model-level error that reads:
Incorrect login.
<a href="/reset">Reset Password</a>.
@Html.ValidationSummary() is encoding the html.
I have tried creating a custom HtmlHelper for this but it’s still doing the same thing.
I’ve also checked the source code and the ValidationSummary method uses internal methods that I can’t use to recreate a helper for this.
Is there a way, whether in my view or in a HtmlHelper, to write an Html message if there is a model-level error?
I will use TempData to solve your problem.
In your method you set the message in
then from your view you check if TempData[“Error”] is not empty and then with
you should get your message not encoded