Why does .Replace(Environment.NewLine, "<br />") give this result:
asdasd<br />waahahahaha<br />asdadsa<br />multiline<br /><br /><br />asdad
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Probably because there are more than one new line between “multiline” and “asdad”.
Example
html will now look like this:
Edit
In your case your web page will display the
<br />in the web-browser and not create a new line because it encodes the html output.What you will need to do is use HtmlString, try this:
Also see this thread here on StackOverflow talking about “ASP.NET MVC Razor – output HTML string non escaped”.