I have an aspx file and a config file...
<%@ Page Language="C#" Debug="true"%>
<%
....
%>
<?xml version="1.0"?>
<configuration>
<appSettings>
....
</appSettings>
<system.web>
<compilation debug="false" strict="false" explicit="true" />
<pages>
<namespaces>
<clear/>
....
<add namespace="OnTimeApi"/>
<add namespace="Newtonsoft.Json"/>
</namespaces>
</pages>
</system.web>
</configuration>
I put these two files in a blank VS solution and included an App_Data/ folder, which has OnTimeApi.dll and Newtonsoft.Json.dll. In VS, it recognizes both these dll files, as the syntax is highlighted correctly. When I run it using iis, however, it gives the following error:
Compiler Error Message: CS0246: The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 33: <add namespace="System.Collections.Generic"/>
Line 34: <add namespace="OnTimeApi"/>
Line 35: <add namespace="Newtonsoft.Json"/>
Line 36: </namespaces>
Line 37: </pages>
Source File: c:\inetpub\ontimeconnector\Web.config Line: 35
Make sure that you don't just add the reference to the App_Data folder, but also the project. Right click the project --> Add Reference, select these DLLs. This should resolve your issue.
If the DLLs are not marked as references for the project, it will not necessarily correctly link/copy them to output at compile time, and thus may not load them at runtime.