ASP.NET cannot find HttpUtility

The name "HttpUtility" does not exist in the current context.

I'm a little stuck here. I have using System.Web at the top of my file that has no error, and System.Web is listed in my links. I tried double-clicking the link, finding the UrlEncode method in Object Explorer and literally dragging the method into my code, and it still cannot find HttpUtility . What am I missing?

Here is the code folded:

 using System.Web 

 string path = "path/to/file"; path = HttpUtility.UrlEncode(path); 

A fully qualified HttpUtility does not help either. It does not even appear in the autocomplete list. Only "AspNetHostingPermission" appears.

+6
source share
1 answer

See how you have another library in your solutions and what you are trying to access HttpUtility. If this is correct, you need to add a link to the System.Web dll in your library.

Let me know if that were the case.

+8
source

Source: https://habr.com/ru/post/907876/


All Articles