Binding Class

Definition

Represents the binding instructions for a Web site.

public ref class Binding : Microsoft::Web::Administration::ConfigurationElement
public class Binding : Microsoft.Web.Administration.ConfigurationElement
type Binding = class
    inherit ConfigurationElement
Public Class Binding
Inherits ConfigurationElement
Inheritance

Examples

The following example gets and displays the bindings for each site.

_serviceProxy = (TestDemoModuleServiceProxy)
    Connection.CreateProxy(Module, typeof(TestDemoModuleServiceProxy));

// Get the site collection on this server.
SiteCollection siteCollection = _serviceProxy.GetSiteCollection();
string collectiondisplay = null;
collectiondisplay = "There are " + siteCollection.Count.ToString() + " sites:\n\n";
string sitedisplay = null;
foreach (Site site in siteCollection)
{
    sitedisplay = sitedisplay + site.Name + ": ID= " + site.Id + "\n";
    // Display each property of each bindings.
    string bindingdisplay = null;
    foreach (Microsoft.Web.Administration.Binding binding in site.Bindings)
    {
        bindingdisplay = bindingdisplay + "  Binding:\n   BindingInformation: " + 
            binding.BindingInformation;
        if (binding.Protocol == "https")
        {
             // There is a CertificateHash and  
             // CertificateStoreName for the https protocol only.
            bindingdisplay = bindingdisplay + "\n   CertificateHash: " + 
                binding.CertificateHash + ": ";
            // Display the hash.
            foreach (System.Byte certhashbyte in binding.CertificateHash)
            {
                bindingdisplay = bindingdisplay + certhashbyte.ToString() + " ";
            }
            bindingdisplay = bindingdisplay + "\n   CertificateStoreName: " + 
                binding.CertificateStoreName;
        }
        bindingdisplay = bindingdisplay + "\n   EndPoint: " + binding.EndPoint;
        bindingdisplay = bindingdisplay + "\n   Host: " + binding.Host;
        bindingdisplay = bindingdisplay + "\n   IsIPPortHostBinding: " + binding.IsIPPortHostBinding;
        bindingdisplay = bindingdisplay + "\n   Protocol: " + binding.Protocol;
        bindingdisplay = bindingdisplay + "\n   ToString: " + binding.ToString();
        bindingdisplay = bindingdisplay + "\n   UseDsMapper: " + binding.UseDsMapper + "\n\n";
    }
    sitedisplay = sitedisplay + bindingdisplay;
}
collectiondisplay = collectiondisplay + sitedisplay + "\n";
testLabel.Text = collectiondisplay;

Remarks

Site bindings specify the possible protocols and endpoints that are available for applications that are running on a Web site. A binding specifies how clients and IIS Manager communicate. There can be multiple bindings for any site.

You can view the bindings for a site in the Site Bindings dialog box in IIS Manager. To open the dialog box, right-click a site node in the Connections pane, and then click Edit Bindings. The Site Bindings dialog box displays the Binding objects in the BindingCollection object for the site.

Properties

Attributes

Gets a configuration attribute collection that contains the list of attributes for this element.

(Inherited from ConfigurationElement)
BindingInformation

Gets or sets the binding information for the current binding.

CertificateHash

Gets or sets the hash of the certificate to bind.

CertificateStoreName

Gets or sets the name of the certificate store.

ChildElements

Gets all the child elements of the current element.

(Inherited from ConfigurationElement)
ElementTagName (Inherited from ConfigurationElement)
EndPoint

Gets the IP endpoint of the binding.

Host

Gets the host value of the binding.

IsIPPortHostBinding

Gets a value indicating whether the binding is bound to an IP port.

IsLocallyStored

Gets a value indicating whether the configuration element is stored in a particular configuration file.

(Inherited from ConfigurationElement)
Item[String]

Gets or sets an attribute with the specified name.

(Inherited from ConfigurationElement)
Methods

Gets a collection of methods for the configuration element.

(Inherited from ConfigurationElement)
Protocol

Gets or sets the protocol the binding will use.

RawAttributes (Inherited from ConfigurationElement)
Schema

Gets the schema for the current element.

(Inherited from ConfigurationElement)
SslFlags
UseDsMapper

Gets or sets a value indicating whether the binding will use Active Directory mapping.

Methods

Delete() (Inherited from ConfigurationElement)
GetAttribute(String)

Returns a ConfigurationAttribute object that represents the requested attribute.

(Inherited from ConfigurationElement)
GetAttributeValue(String)

Returns the value of the specified attribute.

(Inherited from ConfigurationElement)
GetChildElement(String)

Returns a child element that is under the current configuration element and has the specified name.

(Inherited from ConfigurationElement)
GetChildElement(String, Type)

Returns a child element that is under the current configuration element and has the specified name and type.

(Inherited from ConfigurationElement)
GetCollection()

Returns the default collection for the current configuration element.

(Inherited from ConfigurationElement)
GetCollection(String)

Returns all configuration elements that belong to the current configuration element.

(Inherited from ConfigurationElement)
GetCollection(String, Type)

Returns the configuration element that has the specified name and type and is under the current configuration element.

(Inherited from ConfigurationElement)
GetCollection(Type)

Returns the configuration element that has the specified type and is under the current configuration element.

(Inherited from ConfigurationElement)
GetMetadata(String)

Returns metadata values from the element schema.

(Inherited from ConfigurationElement)
SetAttributeValue(String, Object)

Sets the value of the specified attribute.

(Inherited from ConfigurationElement)
SetMetadata(String, Object)

Sets metadata values from the element schema.

(Inherited from ConfigurationElement)
ToString()

Returns a string representation of the binding object.

Applies to