1

I have a rich text box that generates HTML markup in a textarea (i.e the JavaScript library called nicEdit). However, because the server has request validation and I am not allowed to disable it, I have to encode the HTML text before submitting it. In order to do that, I need to be able to detect whenever a postback occurs (i.e when the page is being reloaded) in order to encode the HTML content of the textarea before it is sent to the server.

I found an SO question showing how to do that with asynchronous postback requests, but not with synchronous ones.

How could this be acheived ? Thank you.

Virus721
  • 8,061
  • 12
  • 67
  • 123
  • I can see only two choices. One is to disable request validation either at page or control level. The other is to encode the value of the control via javascript prior to posting, for example: https://stackoverflow.com/questions/4146309/in-a-text-box-in-asp-net-how-to-allow-it – dpant Nov 15 '18 at 18:13
  • 1
    @dpant Thanks for your comment. This is what I ended up doing : encoding / decoding in base 64 (no extra lib required on client or server side) and replaced the rich text box library with another one called Quill that is more practical to code with. – Virus721 Nov 16 '18 at 19:19

0 Answers0