2

I download a project on Gitgub Basically is a Console Application. But I want to translate this C# Console Application to a Universal Windows App.

I want to use HttpUtility.UrlEncode in a windows 10 universal, but I can not find System.Web in .NET (Add Reference) How can I add this assembly to my project?

Error: The "HttpUtility" Does not existin the current context.

Im using Visual Studio 2015

I try with this question: How Add System.Web Reference To A Windows Form Application But doesnt work for the Universal 10 app.

Thanks in advance!

Community
  • 1
  • 1
Juan P. Ortiz
  • 568
  • 1
  • 6
  • 21

1 Answers1

4

The System.Web assembly is a huge monolith that Microsoft themselves seem to be moving away from.

Usually, for any functionality found within System.Web, there's a modern equivalent that can be found elsewhere.

In this case, you'd be looking for WebUtility.UrlEncode instead, which is found in the System.Net assembly and is listed as supported on the Universal Windows Platform.

Damien_The_Unbeliever
  • 234,701
  • 27
  • 340
  • 448
  • 1
    Excellent. WARNING TO ALL: If you use HttpUtility.UrlEncode in a UWP app, and utilize resharper to import and reference `System.Web`, you will likely get the elusive `error 0x80073b0f: Processing Resources failed with error: Duplicate Entry` and `Conflicting values for resource 'System.Design/ClassComments1` errors. – bunkerdive Sep 22 '16 at 20:43
  • I would like to note that this solution wonderfully corrects those issues, at least for me. – bunkerdive Sep 22 '16 at 20:43
  • What about all of the other functionality in HttpUtility? -- i.e. [HttpUtility.ParseQueryString](https://msdn.microsoft.com/en-us/library/ms150046(v=vs.110).aspx) for example. – BrainSlugs83 Jan 10 '17 at 23:15
  • @BrainSlugs83 - [`UriExtensions.ParseQueryString`](https://msdn.microsoft.com/en-us/library/hh835079(v=vs.118).aspx)? – Damien_The_Unbeliever Jan 11 '17 at 06:26