25

I recently started using LINQPad to test bits and pieces and its a great time saver.

However, sometimes it gives me some errors with minor things.

when I want to test this:

HttpUtility.UrlPathEncode("Make sure");

I get this error: The name 'HttpUtility' does not exist in the current context.

Is there a way to get it to recognize basic stuff like HttpUtility?


I just tried writing:

System.Web.HttpUtility.UrlPathEncode("Make sure")

and I am shown this: The type or namespace name 'HttpUtility' does not exist in the namespace 'System.Web'

1 Answer 1

39

You need to a reference System.Web.dll. Press F4 (References) and add a reference to that DLL.

Or, if you have an autocompletion license, just type your original query:

HttpUtility.UrlPathEncode("Make sure");

and open the smart-tag that automatically appears. It will present a menu option to add the reference to System.Web.dll and import the System.Web namespace in a one-fell-click!

1
  • 1
    You can find the DLL at C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5 Sep 30, 2019 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.