AntiXSS HtmlEncode Textarea line break loss
问题 I am developing web application on ASP.NET and I am getting textarea input from users and later display this input on website. While saving input into database I am not encoding input and directly write them into db. If input contains "enter" I don't want to lose line breaks. So I am replacing data like that: Replace("\r\n", " <br /> ") And to prevent XSS attack before displaying I am encoding data using Microsoft's AntiXSS library's Microsoft.Security.Application.Encoder.HtmlEncode function.