Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Performs custom logging of FTP activity for the IFtpLogProvider interface.
Syntax
void Log(
FtpLogEntry loggingParameters
)
Sub Log(
ByVal loggingParameters As FtpLogEntry
)
Parameters
Parameter Name | Description |
---|---|
loggingParameters |
An FtpLogEntry class that contains FTP log information. |
Return Value
void
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 the 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);
}
}
}
}
For an additional example, see How to Use Managed Code (C#) to Create a Simple FTP Logging Provider.
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 |