They both encode html
Why microsoft use several different function?
Which one is better?
are there any strings that are encoded differently between 2 functions?
I notice that System.Web.HttpUtility.HtmlEncode doesn’t work in client framework. Why?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Well, for starters you’re comparing apples to oranges.
HtmlEncodedeals with characters specific to the HTML language, whereUrlEncodeis for formatting characters that aren’t valid in a URL.They both have their uses, and by their names it should be obvious which you need to use for the problem you’re trying to solve.
The Client Framework excludes those .Net features that are typically only used in server applications…of course we usually find that we need that one method which isn’t included in the Client Framework to do what we need, so alot of projects that do something creative or interesting end up targeting the full .Net Framework by the time they are finished.