Alternative to HttpUtility for .NET 3.5 SP1 client

2019-02-04 16:51发布

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.

7条回答
我想做一个坏孩纸
2楼-- · 2019-02-04 17:47

The .NET 3.5 SP1 Client Profile Setup Package is the "cut down" version of .NET that only includes what Microsoft perceive to be the "useful" bits of .NET for client applications. So, useful things like the HttpUtility classes are missing.

For more on that see ScottGu's blog, search for "Client Profile Setup Package".

To get around this you could always extract System.Web.dll from the GAC (it'll be in c:\windows\Microsoft.NET\Framework\ ... ) and deploy it with your application. You will, however, need to track updates and service packs as you deploy.

Better might be to take the hit of the full .NET Framework deployment.

查看更多
登录 后发表回答