Site.ApplicationDefaults Site.ApplicationDefaults Site.ApplicationDefaults Site.ApplicationDefaults Property


Gets the default values for applications that are configured under the current Web site.

 property Microsoft::Web::Administration::ApplicationDefaults ^ ApplicationDefaults { Microsoft::Web::Administration::ApplicationDefaults ^ get(); };
public Microsoft.Web.Administration.ApplicationDefaults ApplicationDefaults { get; }
member this.ApplicationDefaults : Microsoft.Web.Administration.ApplicationDefaults
Public ReadOnly Property ApplicationDefaults As ApplicationDefaults

Property Value

An ApplicationDefaults object that represents the configured default values for applications configured for this site.


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

namespace AdministrationSnippets
    public class AdministrationApplicationDefaults
// Displays the default application values for all configured sites.
public void GetApplicationDefaults()
    ServerManager manager = new ServerManager();
    foreach (Site s in manager.Sites)
        ApplicationDefaults d = s.ApplicationDefaults;
        Console.WriteLine("Site: {0}", s.Name);
        Console.WriteLine("  |--Default Application Pool:  {0}", 
        Console.WriteLine("  +--Default Protocols Enabled: {0}\r\n", 

// Sets the default values for applications configured under the 
// default Web site.
public void SetApplicationDefaults()
    ServerManager manager = new ServerManager();
    Site defaultSite = manager.Sites["Default Web Site"];
    ApplicationDefaults defaultVals = defaultSite.ApplicationDefaults;

    // Set the application defaults.
    defaultVals.ApplicationPoolName = "CommunitySites";
    defaultVals.EnabledProtocols = "http";
    // Create a new application.
        "/discussion", @"C:\inetpub\wwwroot\forums");

    // Read the application's values.
    Application discussion = defaultSite.Applications["/discussion"];
    Console.WriteLine("Site: {0}", defaultSite.Name);
    Console.WriteLine("  |--Default Application Pool:  {0}", 
    Console.WriteLine("  +--Default Protocols Enabled: {0}\r\n", 


An ApplicationDefaults object represents the application's configuration values that will be inferred by IIS if the values are not explicitly set. The values are not represented in the object model until they have been written to the configuration system by using the Microsoft.Web.Administration.ServerManager.CommitChanges method and then read back.

Applies to