IFtpAuthenticationProvider.Initialize Method
Initializes a new instance of the IFtpAuthenticationProvider 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 |
|
Server |
|
Product |
|
Reference |
Microsoft.Web.FtpServer.dll |