Reputation:
I want to create a code/knowledge base where I can save my vb.net/c#.net/sqlserver code snippets for use later.
I've tried setting the ValidateRequest property to false in my page directive, and encoding the value with HttpUtility.HtmlEncode (c#.net), but I still get errors.
thoughts?
Upvotes: 1
Views: 1462
Reputation: 1120
The HttpUtility.HtmlEncode will happen too late, assuming you are getting the exception on postback of code from the client. You can run some javascript on the client to pre-encode the server Postback.
See the following link for a quick example: Comparing escape(), encodeURI(), and encodeURIComponent()
Upvotes: 1