In my scenario I’d like to display a text with URL link within validation message attached to form element on MVC view. I’m using ValidationExtensions.ValidationMessage extension method, like this:
<%=Html.ValidationMessage(Model.Name) %>
The behavior I’m seeing is that validation message is HTML escaped, what effectively prevents me from adding a link to message. Is there a way to circumvent this behavior? My error messages aren’t user-supplied, so I don’t think I have to worry about output sanitization here…
I’m guessing that since Html.ValidationMessage is built in you’re going to either create your own version, or if you’re feeling creative, since it returns a string, assign that and then unescape the characters you want to change back.