IFtpRoleProvider.Initialize Method

 

Initializes a new instance of the IFtpRoleProvider interface.

Syntax

protected override void Initialize(
   StringDictionary config
)
Overrides Sub Initialize(   ByVal config As StringDictionary)

Parameters

  • config
    [IN] A StringDictionary that contains key/value pairs from the IIS configuration settings.

Return Value

void

Remarks

You can specify parameters for an FTP provider in the IIS applicationHost.config file by adding an <activation> collection, which may contain a series of <providerData> elements that list additional settings for custom FTP providers. Each <providerData> element is paired with an entry in the <providerDefinitions> collection, and contains a series of key/value pairs that contain information that is specific to each provider. By overriding the Initialize method, your module can retrieve the series of key/value pairs from the configuration store.

The following configuration excerpt illustrates a custom FTP provider entry in the applicationHost.config file and its related information.

<system.ftpServer>
   <providerDefinitions>
      <add name="FtpDemo"
         type="FtpDemo.DemoProvider,FtpDemo,version=1.0.0.0,Culture=neutral,PublicKeyToken=f0e1d2c3b4a59687" />
      <activation>
         <providerData name="FtpDemo">
            <add key="one" value="1" />
            <add key="two" value="2" />
         </providerData>
      </activation>
   </providerDefinitions>
</system.ftpServer>

Example

The following code example iterates through the array of configuration settings and sends the key/value pairs to the debug stream.

protected override void Initialize(StringDictionary config)
{
   base.Initialize(config);
   // List the number of configuration entries for this provider.
   Debug.WriteLine("Config Entries: " + config.Count);
   if (config.Count > 0)
   {
      // Enumerate the individual configuration entries.
      foreach (DictionaryEntry entry in config)
      {
         // List the key name and value for each configuration entry.
         Debug.WriteLine(entry.Key + ": " + entry.Value);
      }
   }
}

Requirements

Type

Description

Client

  • IIS 7.5 on Windows 7

  • IIS 8.0 on Windows 8

  • IIS 10.0 on Windows 10

Server

  • IIS 7.5 on Windows Server 2008 R2

  • IIS 8.0 on Windows Server 2012

  • IIS 8.5 on Windows Server 2012 R2

  • IIS 10.0 on Windows Server 2016 Technical Preview

Product

  • IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0

Reference

Microsoft.Web.FtpServer.dll

See Also

IFtpRoleProvider Interface (Managed)