IIS 7.0: IFtpRoleProvider Interface (Managed)
IIS 7.0: IFtpRoleProvider Interface (Managed)

Provides an interface for authorization and role checks.

 [C#]
public interface IFtpRoleProvider
Public Interface IFtpRoleProvider
Methods

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

IIS 7.0: IFtpRoleProvider.IsUserInRole Method

Checks if a user is a member of a specific role.

Example

The following code example illustrates using the IFtpAuthenticationProvider and IFtpRoleProvider interfaces to create a custom authentication module for the FTP service that implements both user name and role checks.

using System;
using Microsoft.Web.FtpServer;

namespace FtpAuthentication
{
      public class FtpAuthDemo : BaseProvider,
      IFtpAuthenticationProvider,
      IFtpRoleProvider
   {
      bool IFtpAuthenticationProvider.AuthenticateUser(
         string sessionId,
         string siteName,
         string userName,
         string userPassword,
         out string canonicalUserName)
      {
         // Note: You would add your own custom logic here.
         canonicalUserName = userName;
         string strUserName = "MyUser";
         string strPassword = "MyPassword";

         // Verify that the user name and password are valid.
         // Note: In this example, the user name is case-insensitive
         // and the password is case-sensitive.
         if (((userName.Equals(strUserName,
            StringComparison.OrdinalIgnoreCase))==true) &&
            userPassword == strPassword)
         {
            return true;
         }
         else
         {
            return false;
         }
      }
      bool IFtpRoleProvider.IsUserInRole(
      string sessionId,
         string siteName,
         string userName,
         string userRole)
      {
         // Note: You would add your own custom logic here.
         string strUserName = "MyUser";
         string strRoleName = "MyRole";

         // Verify that the user name and role name are valid.
         // Note: In this example, both the user name and
         // the role name are case-insensitive.
         if (((userName.Equals(strUserName,
            StringComparison.OrdinalIgnoreCase))==true) &&
            ((userRole.Equals(strRoleName,
            StringComparison.OrdinalIgnoreCase))==true))
         {
            return true;
         }
         else
         {
            return false;
         }
      }
   }
}
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