我试图写一个调用的Web网站数据的Windows客户端应用程序。为了使安装到最低限度,我只是想用的dll在.NET Framework客户端配置文件 。麻烦的是,我需要UrlEn $ C C一些参数$,有一个简单的方法来做到这一点,而不用导入System.Web.dll中这不是客户端Pofile?
I am trying to write a windows client application that calls a web site for data. To keep the install to a minimum I am trying only use dlls in the .NET Framework Client Profile. Trouble is that I need to UrlEncode some parameters, is there an easy way to do this without importing System.Web.dll which is not part of the Client Pofile?
System.Uri.EscapeUriString()
是有问题的某些人物,对我来说这是一个数字/磅的#号在字符串中的
System.Uri.EscapeUriString()
can be problematic with certain characters, for me it was a number / pound '#' sign in the string.
如果这是你的问题,试试:
If that is an issue for you, try:
System.Uri.EscapeDataString() //Works excellent with individual values
相反。
下面是一个太问题的答案,解释的区别:
Here is a SO question answer that explains the difference:
what's EscapeUriString之间的差和EscapeDataString 的