Files outside of App_Code
are compiled when Visual Studio calls the C# compiler and passes it the appropriate referenced assemblies (DLLs) based on the references in the csproj file.
Files inside App_Code
are compiled when ASP.NET at runtime calls the C# compiler and passes it the appropriate referenced assemblies (DLLs) based on the reference in the web.config file.
To add a reference to System.Net.Http
(the assembly where HttpResponseMessage
is located), open your web.config file and merge in this setting:
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</assemblies>
</compilation>