替代HttpUtility的.NET 3.5 SP1客户端框架?客户端、框架、NET、HttpUtility

2023-09-07 02:22:45 作者:不在作践自己

这将会是非常好的来定位我的Windows窗体应用程序到.NET 3.5 SP1的客户的框架。但是,现在我使用 HttpUtility.HtmlDe code HttpUtility.UrlDe code 功能和MSDN文档不指向任何替代品里面,比方说,System.Net什么的。

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.

因此​​,短距离reflectoring源$ C ​​$ C并将其复制到我的组装---我不觉得这是值得的---有没有替代品的.NET 3.5 SP1客户端框架内,你知道,更换这个功能?这似乎有点奇怪,他们会限制这些有用的功能服务器仅code。

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.

推荐答案

我强烈建议不要滚动您自己的编码。我会使用微软反跨站点脚本库这是非常小的(1.5版是〜30KB),如果HttpUtility.HtmlEn code是不可用的。

I’d strongly not recommend rolling your own encoding. I’d use the Microsoft Anti-Cross Site Scripting Library which is very small (v1.5 is ~30kb) if HttpUtility.HtmlEncode isn’t available.

至于解码,也许你可以使用从解码程序单?

As for decoding, maybe you could use the decoding routine from Mono?