Reputation: 837
I have comments on my site and because it's its my portfolio I want code samples to be able to be placed however when I try to pass html through the querystring it will stop it because of pagevalidation.
Now I've turned it off but it wouldn't work so I decided to encode it on the client's side with javascript.
However now my query string ends up looking like this.
{&body=<%3b%2fhtml>%3b}
now because of the & body subsequently equals "".
How do i solve this?
Upvotes: 0
Views: 1579
Reputation: 15086
You can use System.Web.HttpUtility.UrlEncode
and System.Web.HttpUtility.UrlDecode
to convert to and from query string encoding.
(Html on the querysting sounds a bit challenging giving the restrictions on query string lengths.)
Upvotes: 2