Share via


VirtualDirectoryDefaults.LogonMethod Eigenschaft

Definition

Ruft die Authentifizierungsmethode ab, die standardmäßig für alle virtuellen Verzeichnisse im aktuellen Kontext verwendet wird, oder legt diese fest.

public:
 property Microsoft::Web::Administration::AuthenticationLogonMethod LogonMethod { Microsoft::Web::Administration::AuthenticationLogonMethod get(); void set(Microsoft::Web::Administration::AuthenticationLogonMethod value); };
public Microsoft.Web.Administration.AuthenticationLogonMethod LogonMethod { get; set; }
member this.LogonMethod : Microsoft.Web.Administration.AuthenticationLogonMethod with get, set
Public Property LogonMethod As AuthenticationLogonMethod

Eigenschaftswert

Einer der AuthenticationLogonMethod-Werte. Der Standardwert ist ClearText.

Beispiele

Im folgenden Beispiel wird eine neue Anwendung erstellt, die die Standardeinstellungen für virtuelle Verzeichnisse explizit festgelegt hat, und dann zwei neue virtuelle Verzeichnisse erstellt. Die Standardeinstellungen des virtuellen Verzeichnisses werden auf die neu erstellten Verzeichnisse angewendet, wenn Sie das Konfigurationssystem durch Aufrufen der CommitChanges -Methode aktualisieren.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Web.Administration;
using Microsoft.Web.Management;

namespace AdministrationSnippets
{
    public class AdministrationApplicationVirtualDirectoryDefaults
    {

// Creates a new application, sets the virtual directory  
// defaults, creates two new virtual directories, and then  
// displays the new virtual directory values.
public void SetVirtualDirectoryDefaults()
{
    ServerManager manager = new ServerManager();
    Site defaultSite = manager.Sites["Default Web Site"];

    // Set up the defaults for the default application of the 
    // default Web site.
    Application app = defaultSite.Applications.Add(
        "/JohnDoe", @"C:\inetpub\wwwroot\john");

    app.VirtualDirectoryDefaults.LogonMethod = 
        AuthenticationLogonMethod.ClearText;
    app.VirtualDirectoryDefaults.UserName = @"NorthWest\JohnDoe";
    app.VirtualDirectoryDefaults.Password = @"kB56^j83!T";

    // Add two virtual directories.
    app.VirtualDirectories.Add(
        "/blogs" , @"\\FileServer\c$\blog_content\");
    app.VirtualDirectories.Add(
        "/photos", @"\\FileServer\c$\photo_content\");
    manager.CommitChanges();

    // Read the updated configuration.
    app = defaultSite.Applications["/JohnDoe"];

    foreach (VirtualDirectory vdir in app.VirtualDirectories)
    {
        Console.WriteLine("Virtual Directory Found: {0}", vdir.Path);
        Console.WriteLine("  |-Logon Method : {0}", vdir.LogonMethod);
        Console.WriteLine("  |-Username     : {0}", vdir.UserName);
        Console.WriteLine("  +-Password     : {0}", vdir.Password);
    }
}
    }
}

Gilt für: