Share via


IWMSAdminAnonUser.SetUserNamePassword (C#)

banner art

Previous Next

IWMSAdminAnonUser.SetUserNamePassword (C#)

The SetUserNamePassword method specifies a user name and password for the authorization process.

Syntax

  IWMSAdminAnonUser
  .SetUserNamePassword(
  newUserName
  , newPassword);

Parameters

newUserName

[in] string containing the user name. This cannot be longer than 63 characters.

newPassword

[in] string containing the password.

Return Values

This method does not return a value.

If this method fails, it throws an exception.

Number Description
0x80070057 The length of the user name exceeds 63 characters.
0x8007000E The server cannot allocate memory for a new user name.

Example Code

using Microsoft.WindowsMediaServices.Interop;
using System.Runtime.InteropServices;

// Declare variables.
WMSServer Server;
IWMSPlugin Plugin;
IWMSAdminAnonUser AdminAnonUser;

try {
    // Create a new WMSServer object.
    Server = new WMSServerClass();

    // Retrieve the plug-in to be configured.
    Plugin = Server.Authenticators[
                    "WMS Anonymous User Authentication"];

    // Retrieve the custom interface of the plug-in.
    AdminAnonUser =
        (IWMSAdminAnonUser)Plugin.CustomInterface;

    // Set a new user name and password to be associated
    // with anonymous server connections.
    AdminAnonUser.SetUserNamePassword("NewUserName", "NewPassword");
}
catch (COMException comExc) {
    // TODO: Handle COM exceptions.
}
catch (Exception e) {
    // TODO: Handle exceptions.
}

Requirements

Reference: Add a reference to Microsoft.WindowsMediaServices.

Namespace: Microsoft.WindowsMediaServices.Interop.

Assembly: Microsoft.WindowsMediaServices.dll.

Library: WMSServerTypeLib.dll.

Platform: Windows Server 2003 family, Windows Server 2008 family.

See Also

Previous Next