Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LINQPad 4 doesn't know about HttpUtililty - how to resolve?

Tags:

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'

like image 635
iamserious Avatar asked Feb 16 '11 10:02

iamserious


1 Answers

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!

like image 196
Joe Albahari Avatar answered Sep 24 '22 02:09

Joe Albahari