IIS 7.0: IFtpLogProvider Interface (Managed)
IIS 7.0: IFtpLogProvider Interface (Managed)

Provides an interface for custom logging of FTP activity.

Public Interface IFtpLogProvider
Methods

The following table lists the methods exposed by the IFtpLogProvider interface.

IIS 7.0: IFtpLogProvider.Log Method

Performs logging activity for the IFtpLogProvider interface.

Example

The following code example illustrates using the IFtpLogProvider interface to create a custom logging module for the FTP service.

using System;
using System.IO;
using Microsoft.Web.FtpServer;

namespace FtpLogging
{
   public class FtpLogDemo : BaseProvider,
      IFtpLogProvider
   {
      void IFtpLogProvider.Log(FtpLogEntry loggingParameters)
      {
         // Note: You would add your own custom logic here.
         // Open the log file for output.
         using (StreamWriter sw =
            new StreamWriter(@"C:\logfiles\myftpsite\myftplog.log",true))
            {
            // Retrieve the current date and time for the log entry.
            DateTime dt = DateTime.Now;
            // Retrieve thr user name.
            string un = loggingParameters.UserName;
            // Write the log entry to the log file.
            sw.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}\t{5}",
               dt.ToShortDateString(),
               dt.ToLongTimeString(),
               loggingParameters.RemoteIPAddress,
                (un.Length == 0) ? "-" : un,
               loggingParameters.Command,
               loggingParameters.SessionId);
         }
      }
   }
}
Requirements

Type

Description

Client

IIS 7.5

Server

IIS 7.5

Product

FTP 7.5

Reference

Microsoft.Web.FtpServer.dll

See Also

Reference

© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View