IIS FTP with ASP.NET membership authentication


This is my second blog on FTP. The first one being this.

This blog specifically explains how to address the below error which most of them have encountered while setting up the ASP.NET SQL membership authentication with FTP site:

Response:       220 Microsoft FTP Service

Command:        USER test

Response:       331 Password required

Command:        PASS *********

Response:       530-User cannot log in.

Response:       Win32 error:

Response:       Error details: System.Web: Default Membership Provider could not be found.

Response:       530 End

Error:          Critical error: Could not connect to server

You can follow this blog to configure the authentication with SQL membership for the FTP site on IIS.

Post this if you still run into the above issue then you need to ensure that the following steps are followed:

Steps 1:

Have the below setting within the web.config within the <configuration> tag. (depending on the framework and the bitness your application pool is using)

Example: If your AppPool is 64 bit running under .NET 4.0. You should be using the location C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config

<location path="GlobalFtpSite/ftpsvc">
  <connectionStrings>

    <add connectionString="server=localhost;database=aspnetdb;Integrated Security=SSPI" name="FtpLocalSQLServer" />

   </connectionStrings>

<system.web>

   <membership defaultProvider="FtpSqlMembershipProvider">

     <providers>

        <add name="FtpSqlMembershipProvider"

           type="System.Web.Security.SqlMembershipProvider,System.Web,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a"

           connectionStringName="FtpLocalSQLServer"

           enablePasswordRetrieval="false"

           enablePasswordReset="false"

           requiresQuestionAndAnswer="false"

          applicationName="/"

           requiresUniqueEmail="false"

           passwordFormat="Clear" />

      </providers>

   </membership>

   <roleManager defaultProvider="FtpSqlRoleProvider" enabled="true">

      <providers>

        <add name="FtpSqlRoleProvider"

           type="System.Web.Security.SqlRoleProvider,System.Web,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a"

           connectionStringName="FtpLocalSQLServer"

           applicationName="/" />

         </providers>

      </roleManager>

   </system.web>

</location>

</configuration>

Note:

If you are making use AppPool which is on .NET version 2.0 with 64 bit, then you need to modify the web.config in the location C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG. Also ensure that you have modified the above highlighted section to 2.0.0.0.

Steps 2:

Grant the permissions to the Network Service Account Write / Modify permissions to the C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\ folder. Note: depending on your AppPool framework and bitness the above path can differ.

Steps 3:

Remember You don't need to have any settings at the FTP website level for the .NET Roles, .NET Users etc, Because the root web.config setting should apply to all the applications which run on that version of framework and bitness.

Hope this helps 🙂


Comments (0)

Skip to main content