title: Membership with postgresql using npgsql
body: <p>I'm trying to create MVC 3 application that uses postgresql for database and should be able to run in linux using mono. I planned to use Membership for user managin and authentication but keep getting error when trying to create new user.
  I'm using Npgsql for data provider and NauckIT.PostgreSQLProvider for membership. 
  This is my Web.config</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;configuration&gt;
  &lt;appSettings&gt;
    &lt;add key="webpages:Version" value="1.0.0.0" /&gt;
    &lt;add key="ClientValidationEnabled" value="true" /&gt;
    &lt;add key="UnobtrusiveJavaScriptEnabled" value="true" /&gt;
  &lt;/appSettings&gt;
  &lt;system.web&gt;
    &lt;compilation debug="true" targetFramework="4.0" /&gt;
      &lt;authentication mode="Forms"&gt;
        &lt;forms name=".AspNetAuth" protection="All" defaultUrl="~/Default.aspx" loginUrl="~/Account/LogOn" timeout="3000" path="/" requireSSL="false" slidingExpiration="true" enableCrossAppRedirects="false" /&gt;
      &lt;/authentication&gt;
  &lt;pages&gt;
    &lt;namespaces&gt;
      &lt;add namespace="System.Web.Helpers" /&gt;
      &lt;add namespace="System.Web.Mvc" /&gt;
      &lt;add namespace="System.Web.Mvc.Ajax" /&gt;
      &lt;add namespace="System.Web.Mvc.Html" /&gt;
      &lt;add namespace="System.Web.Routing" /&gt;
      &lt;add namespace="System.Web.WebPages" /&gt;
    &lt;/namespaces&gt;
  &lt;/pages&gt;
  &lt;machineKey validationKey="AF2DD8866752787D1FAC5DA9EDBDB829EF9D41D4BFFAB47481399D9FBC215C7AC45E4FDF67EF66D374629F047429181C3CCAB1DEDC9BFA0D3F07B1A187D57CB2" decryptionKey="1698432D7389DCF12FC6DDA1C58F7EF7F9A82A9FA330AFFDF69858DCC095D449" validation="SHA1" decryption="AES" /&gt;
  &lt;membership defaultProvider="PgMembershipProvider"&gt;
    &lt;providers&gt;
      &lt;clear /&gt;
      &lt;add name="PgMembershipProvider" type="NauckIT.PostgreSQLProvider.PgMembershipProvider" connectionStringName="AspSQLProvider" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" passwordFormat="Hashed" applicationName="member" /&gt;
    &lt;/providers&gt;
  &lt;/membership&gt;
  &lt;roleManager enabled="true" defaultProvider="PgRoleProvider" cacheRolesInCookie="true" cookieName=".AspNetRoles" cookiePath="/" cookieProtection="All" cookieRequireSSL="false" cookieSlidingExpiration="true" createPersistentCookie="false" cookieTimeout="30" maxCachedResults="25"&gt;
    &lt;providers&gt;
      &lt;clear /&gt;
      &lt;add name="PgRoleProvider" type="NauckIT.PostgreSQLProvider.PgRoleProvider" connectionStringName="AspSQLProvider" applicationName="member" /&gt;
    &lt;/providers&gt;
  &lt;/roleManager&gt;
  &lt;profile enabled="true" defaultProvider="PgProfileProvider"&gt;
    &lt;providers&gt;
      &lt;clear /&gt;
      &lt;add name="PgProfileProvider" type="NauckIT.PostgreSQLProvider.PgProfileProvider" connectionStringName="AspSQLProvider" applicationName="member" /&gt;
    &lt;/providers&gt;
    &lt;properties&gt;
      &lt;add name="FirstName" /&gt;
      &lt;add name="LastName" /&gt;
    &lt;/properties&gt;
  &lt;/profile&gt;
  &lt;sessionState mode="Custom" customProvider="PgSessionStateStoreProvider"&gt;
    &lt;providers&gt;
      &lt;clear /&gt;
      &lt;add name="PgSessionStateStoreProvider" type="NauckIT.PostgreSQLProvider.PgSessionStateStoreProvider" enableExpiredSessionAutoDeletion="true" expiredSessionAutoDeletionInterval="60000" enableSessionExpireCallback="false" connectionStringName="AspSQLProvider" applicationName="member" /&gt;
    &lt;/providers&gt;
  &lt;/sessionState&gt;
  &lt;/system.web&gt;
  &lt;system.webServer&gt;
    &lt;validation validateIntegratedModeConfiguration="false" /&gt;
    &lt;modules runAllManagedModulesForAllRequests="true" /&gt;
  &lt;/system.webServer&gt;
  &lt;runtime&gt;
    &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt;
      &lt;dependentAssembly&gt;
        &lt;assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /&gt;
        &lt;bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" /&gt;
      &lt;/dependentAssembly&gt;
      &lt;dependentAssembly&gt;
        &lt;assemblyIdentity name="Npgsql" publicKeyToken="5d8b90d52f46fda7" culture="neutral" /&gt;
        &lt;bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0" /&gt;
      &lt;/dependentAssembly&gt;
    &lt;/assemblyBinding&gt;
    &lt;/runtime&gt;
    &lt;connectionStrings&gt;
      &lt;clear /&gt;
        &lt;add name="AspSQLProvider" providerName="Npgsql" connectionString="Server=127.0.0.1;Port=5432;Database=pgtest;User Id=user;Password=pass;Encoding=UNICODE;Sslmode=Prefer;Pooling=true;Protocol=3" /&gt;
    &lt;/connectionStrings&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>In my account controller i do </p>
  
  <pre><code>NpgsqlConnection AspSQLProvider = new NpgsqlConnection(ConfigurationManager.ConnectionStrings["AspSQLProvider"].ConnectionString);
  AspSQLProvider.Open();
  
  MembershipCreateStatus createStatus;
  NauckIT.PostgreSQLProvider.PgMembershipProvider test = new NauckIT.PostgreSQLProvider.PgMembershipProvider();
  test.CreateUser(model.UserName, model.Password, model.Email, null, null, true, null, out createStatus);
  </code></pre>
  
  <p>But CreateUser gives error:</p>
  
  <blockquote>
    <p>Connection string argument missing!
    Parameter name: HOST</p>
  </blockquote>
  
  <p>And i can't get it working. </p>
  
  <p>Can anyone point out what am i doing wrong and how should i do it. Also if someone has other  good solutions how to do user management with postgresql would love to hear them.</p>