Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 611
Rev Avatar asked Mar 08 '26 09:03

Rev


2 Answers

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
like image 67
Elazaron Avatar answered Mar 11 '26 00:03

Elazaron


Try the UrlDecode method on HttpServerUtility:

System.Web.HttpContext.Current.Server.UrlDecode()
like image 45
gerrod Avatar answered Mar 11 '26 00:03

gerrod



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!