Hi, Can someone please tell me what is the difference between the HttpUtility and HttpServerUtility class. Both have the UrlDecode methods, but HttpUtility.UrlDecode takes Encoding and allows to decode in specific encoding. Please let me know.
HttpServerUtility is provided in the context of a web request, so it has other functionality besides urldecode. HttpUtility class is really only there for decode/encode and minor purposes and you can instantiate one yourself without having a web request take
place. For example, I'd use the HttpUtility class if, say, i was developing a WinForms application and needed to show a url friendly link to the user. But i'd use the HttpServerUtility if in a page request, say, in the Page_Load callback, since it's already
there for me (exposed as Server property in the context of the request). So really it's just a matter of "do i already have one created for me?" If not, create an HttpUtility instance, otherwise use the one you've already got.
mylavarapus
Member
55 Points
11 Posts
HttpUtility vs. HttpServerUtility
Apr 08, 2004 09:11 PM|LINK
chapel21
Contributor
2485 Points
499 Posts
Re: HttpUtility vs. HttpServerUtility
Apr 08, 2004 09:41 PM|LINK