0
I have this property and the Data Annotations for it:
[Required(ErrorMessage = "Campo orbgiatório.")]
[RegularExpression("^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d]{8,}$", ErrorMessage = "The password must contain: \n * Pelo menos 8 caracteres; \n *Pelo menos uma letra. \n *Pelo menos um dígito. ")]
public string Password { get; set; }
I want to skip the lines of the error message between each password rule, so I’m using the \n, but it’s not working. The \n just disappears and the message doesn’t break the lines.
Try it the Windows way
\r\n
.\n
is Unix style.– Olivier Jacot-Descombes
Btw. Why do you post an English Question on a Portuguese site?
– Olivier Jacot-Descombes
Hello. Pf put your question in Portuguese, is on Sopt. Ever tried to put
Environment.NewLine
instead of\n
?– João Martins
I confused the accounts, pardon :D
– jf.js
Neither r n nor Enviroment.Newline worked, unfortunately.
– jf.js
Where are you displaying this message? App Console, Windows App, or Web App?
– Leandro Angelo
It is a web page. But using <br> of the html in the message, as you replied, did not work. The message only displays the <br>. Which is very strange, because in your example, it worked;
– jf.js