Shannon
Shannon

Reputation: 837

How to pass html via a querystring?

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=&lt%3b%2fhtml&gt%3b}

now because of the & body subsequently equals "".

How do i solve this?

Upvotes: 0

Views: 1579

Answers (1)

faester
faester

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

Related Questions