开发者

Httputility.urldecode replacement in .Net4?

I got开发者_开发百科 an old Program(class library) developed by .Net 2. Recently I want to use that Program in new project which is use .Net4(For new WPF feature's ). so there is a big problem:

.Net4 don't support System.Web and as result it can't be use Httputility.urldecode!!

So what is urldecode jop? and how can I change that to something, which is support by .Net4?


HttpUtility is wild goose chase for c# users since it's not already there (referenced)
2 alternatives :

  string a =  System.Uri.EscapeUriString("https://some.url.goes.here"); // for path
  string b = System.Uri.EscapeDataString("parameter1=1&parameter2=something"); // for params


Try the UrlDecode method on HttpServerUtility:

System.Web.HttpContext.Current.Server.UrlDecode()


If you really have to run against the client profile (which doesnt include HttpUtility) then you could check this Alternative to HttpUtility for .NET 3.5 SP1 client framework?. (That question is about 3.5 sp1 but nothing has changed in this regard in 4.0)

You really should see if you can't just use the full framework though.


You can also use System.Net.WebUtility.UrlDecode


As you can see in below link, .NET Framework 4 is supporting the HttpUtility. As @Alun is mentioend above, I think you use .NET 4 Client Profile

HttpUtility Class

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜