Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alternative to HttpUtility for .NET 3.5 SP1 client framework?

It'd be really nice to target my Windows Forms app to the .NET 3.5 SP1 client framework. But, right now I'm using the HttpUtility.HtmlDecode and HttpUtility.UrlDecode functions, and the MSDN documentation doesn't point to any alternatives inside of, say, System.Net or something.

So, short from reflectoring the source code and copying it into my assembly---which I don't think would be worth it---are there alternatives inside of the .NET 3.5 SP1 client framework that you know of, to replace this functionality? It seems a bit strange that they'd restrict these useful functions to server-only code.

like image 553
Domenic Avatar asked Aug 30 '08 20:08

Domenic


1 Answers

Found today from this here little site that HtmlEncode/Decode can be done using System.Net library in C# 4.0 Client Profile:

Uri.EscapeDataString(...)
WebUtility.HtmlEncode(...)

Edit: I re-read that the question applied for the 3.5 Client Framework but maybe this can be useful those who have updated 4.0..

like image 71
Almund Avatar answered Sep 20 '22 02:09

Almund