title: c# aspx connect to postgresql with Npgsql
body: <p>I have the annoying task of hooking a c# aspx page up to postgresql with Npgsql.</p>
  
  <p>The problem that i have is that when i try to import Npgsql, i get the following aspx error message returned:</p>
  
  <blockquote>
    <p>CS0246: The type or namespace name 'Npgsql' could not be found (are you missing a using directive or an assembly reference?)</p>
  </blockquote>
  
  <p>I have a javascript function that calls the aspx page below to get data from the db:</p>
  
  <pre><code>&lt;%@ language="C#"%&gt;
  &lt;%@ Import Namespace="Npgsql" %&gt;
  &lt;%
  
    // PostgeSQL-style connection string
    string connstring = String.Format("Server=localhost;Port=5432;UID=posgres;Password=pass;Database=postgres_db;";
    NpgsqlConnection conn = new NpgsqlConnection(connstring);      
    conn.Open();
  %&gt;
  </code></pre>
  
  <p>Im assuming i need to set it up in my web.config, but i cannot for the life of me it out.</p>
  
  <p>Any help would be greatly appreciated!
  Thanks.</p>