Application.EnabledProtocols Property

Definition

Gets or sets the protocols that are enabled for the application.

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

Property Value

A comma-delimited list of the protocols that are enabled for the application. The default is "http".

Examples

The following example reads the configuration for an existing site. The code displays the value returned from the EnabledProtocols property for the applications configured under the default Web site.

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

namespace AdministrationSnippets
{
    public class AdministrationApplicationEnabledProtocols
    {
// Writes out the applications and the protocols enabled for 
// each application under the default Web site.
public void GetEnabledProtocols()
{
    ServerManager manager = new ServerManager();
    Site defaultSite = manager.Sites["Default Web Site"];

    foreach (Application app in defaultSite.Applications)
    {
        Console.WriteLine(
            "{0} has enabled the following protocols: '{1}'", 
            app.Path, app.EnabledProtocols);
    }
}
    }
}

Remarks

This property specifies the protocols that requests can use to access an application. The default value is "http", which enables both the HTTP and HTTPS protocols. A value of "https" also enables both HTTP and HTTPS. If you specify neither "http" nor "https" in the EnabledProtocols property, both HTTP and HTTPS are disabled for your application. If you want to accept only HTTPS requests, configure the Secure Sockets Layer (SSL) feature for your site.

If your site requires additional protocols (such as "NET.TCP") to accept requests, set the EnabledProtocols property by using a comma-delimited list that includes the protocols you need.

Each site can have default protocols configured. If protocols are not explicitly set for the application, EnabledProtocols gets the default protocols that are configured for the site. Use the Microsoft.Web.Administration.Site.ApplicationDefaults property to view the default settings for a site.

Applies to