0

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?

1 Answer 1

2

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.)

Sign up to request clarification or add additional context in comments.

2 Comments

how would you suggest passing it between pages then?
Thanks I htmlencoded and then urlencoded it using javascript then sent it as a query string. Worked then... max comment size is 250 chars and most max querystrings are 8000 so i should be alright with this method.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.