The type or namespace name "WebRequestHandler" could not be found

Be Kind To New Users picture Be Kind To New Users · Aug 30, 2017 · Viewed 11.6k times · Source

I am trying to use the Dropbox.API code that is listed here:

https://github.com/dropbox/dropbox-sdk-dotnet/tree/master/dropbox-sdk-dotnet/Examples/SimpleTest

I copied their Program.cs into my Program.cs without making other changes to other files in my solution/project.

I am getting

The type or namespace name "WebRequestHandler" could not be found.

enter image description here

Despite having this using statement:

using System.Net.Http;

The help text says to add an assembly reference, but I don't know what I would add.

I tried moving the using System.Net.Http to both inside and outside the class.

I am new to C# and .Net development so expect this to be a really newbie problem.

Answer

GrandMasterFlush picture GrandMasterFlush · Aug 30, 2017

Have you included a reference to the System.Net.Http.WebRequest DLL? This is where the WebRequestHandler is found, not in System.Net.Http.

See this article on MSDN.

In short, you can add the reference to System.Net.Http.WebRequest DLL by right clicking on the project and doing Add -> Reference. Expect a popup window to appear and then put a checkmark next to System.Net.Http.WebRequest.