适用于.NET 3.5 SP1客户端框架的HttpUtility替代方案? [英] Alternative to HttpUtility for .NET 3.5 SP1 client framework?

查看:214
本文介绍了适用于.NET 3.5 SP1客户端框架的HttpUtility替代方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将我的Windows Forms应用程序定位到.NET 3.5 SP1 客户端框架是非常好的。但是,现在我正在使用 HttpUtility.HtmlDecode HttpUtility.UrlDecode 函数,MSDN文档不会 t指向System.Net或其他内容中的任何选项。



所以,反映源代码并将其复制到我的程序集中 - 这是我不要以为是值得的 - 在您知道的.NET 3.5 SP1客户端框架中是否有其他替代方案来替代此功能?看起来有点奇怪,他们会将这些有用的功能限制在仅限服务器的代码中。

解决方案

我不会推荐滚动自己的编码。我会使用 Microsoft反跨站点脚本库如果HttpUtility.HtmlEncode不可用,那么它非常小(v1.5是〜30kb)。



对于解码,也许你可以使用解码例程 Mono


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.

解决方案

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?

这篇关于适用于.NET 3.5 SP1客户端框架的HttpUtility替代方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆