The name 'HttpUtility' does not exist in the current context.
I'm a bit stuck here. I have using System.Web
at the top of my file, which has no error, and System.Web
is listed in my references. I tried double-clicking the reference, finding the UrlEncode
method in the object browser, and literally drag-and-dropping the method into my code, and it still can't find HttpUtility
. What am I missing?
Here is the code, boiled down:
using System.Web
string path = "path/to/file";
path = HttpUtility.UrlEncode(path);
Fully qualifying HttpUtility doesn't help either. It doesn't even show up in the auto-complete list. Only "AspNetHostingPermission" shows up.
Look to me like you have another library in your solutions and that's where you are trying to access the HttpUtility. If that's correct, you need to add a reference to System.Web dll in your library.
Let me know if that was the case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With