I am implementing a code snippet uploading feature in my website. I have replaced a textarea with CodeMirror. I plan to let users upload any code including asp.net, javascript, html, css, etc.. I know that this can be a really big security flaw.
It gives me this exception when I submit the form with any code inside the textarea:
HttpRequestValidationException was unhandled by user code.
A potentially dangerous Request.Form value was detected from the client.
I have used Html.Encode(Request.Form("mytextareaname"));
to encode the snippet, but the error persists.
Basically I'd like to let users upload their code, but the site should by no way try to execute it. Maybe comment it out?
How can I achieve this?