Share via


VirtualDirectory.Password Property

Definition

Gets or sets the password that the virtual directory uses to access its configured physical location.

public:
 property System::String ^ Password { System::String ^ get(); void set(System::String ^ value); };
public string Password { get; set; }
member this.Password : string with get, set
Public Property Password As String

Property Value

The clear-text password that the virtual directory uses to access its physical location.

Examples

The following example demonstrates how to set the Password property of a virtual directory.


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

namespace AdministrationSnippets
{
    public class AdministrationAuthenticationLogonMethod
    {
        // Creates a new virtual directory and sets the logon method.
        public void SetLogonMethod()
        {
            ServerManager manager = new ServerManager();
            Site defaultSite = manager.Sites["Default Web Site"];
            Application reports = defaultSite.Applications.Add(
                "/reports", @"\\FileServer\Reports");

            // Configure the default virtual directory for the application.
            VirtualDirectory reportDir = reports.VirtualDirectories[0];
            reportDir.LogonMethod = AuthenticationLogonMethod.Batch;
            reportDir.UserName = @"HumanResources\Jane";
            reportDir.Password = @"iL@1Fnw!";

            manager.CommitChanges();
        }
    }
}

Remarks

You should use this property when the virtual directory requires alternative credentials to access secured content, such as a UNC path. When you set the password for a virtual directory, the value stored in the configuration system is encrypted.

Caution

The value returned from the get accessor of this property is clear text. Use care when you display this value in an unsecured environment.

Applies to