Binding Binding Binding 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 Attributes Attributes Attributes

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

(Inherited from ConfigurationElement)
BindingInformation BindingInformation BindingInformation BindingInformation

Gets or sets the binding information for the current binding.

CertificateHash CertificateHash CertificateHash CertificateHash

Gets or sets the hash of the certificate to bind.

CertificateStoreName CertificateStoreName CertificateStoreName CertificateStoreName

Gets or sets the name of the certificate store.

ChildElements ChildElements ChildElements ChildElements

Gets all the child elements of the current element.

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

Gets the IP endpoint of the binding.

Host Host Host Host

Gets the host value of the binding.

IsIPPortHostBinding IsIPPortHostBinding IsIPPortHostBinding IsIPPortHostBinding

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

IsLocallyStored IsLocallyStored IsLocallyStored IsLocallyStored

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

(Inherited from ConfigurationElement)
Item[String] Item[String] Item[String] Item[String]

Gets or sets an attribute with the specified name.

(Inherited from ConfigurationElement)
Methods Methods Methods Methods

Gets a collection of methods for the configuration element.

(Inherited from ConfigurationElement)
Protocol Protocol Protocol Protocol

Gets or sets the protocol the binding will use.

RawAttributes RawAttributes RawAttributes RawAttributes Inherited from ConfigurationElement
Schema Schema Schema Schema

Gets the schema for the current element.

(Inherited from ConfigurationElement)
SslFlags SslFlags SslFlags SslFlags
UseDsMapper UseDsMapper UseDsMapper UseDsMapper

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

Methods

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

Returns a ConfigurationAttribute object that represents the requested attribute.

(Inherited from ConfigurationElement)
GetAttributeValue(String) GetAttributeValue(String) GetAttributeValue(String) GetAttributeValue(String)

Returns the value of the specified attribute.

(Inherited from ConfigurationElement)
GetChildElement(String) GetChildElement(String) GetChildElement(String) GetChildElement(String)

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

(Inherited from ConfigurationElement)
GetChildElement(String, Type) GetChildElement(String, Type) GetChildElement(String, Type) 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() GetCollection() GetCollection() GetCollection()

Returns the default collection for the current configuration element.

(Inherited from ConfigurationElement)
GetCollection(String) GetCollection(String) GetCollection(String) GetCollection(String)

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

(Inherited from ConfigurationElement)
GetCollection(String, Type) GetCollection(String, Type) GetCollection(String, Type) 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) GetCollection(Type) GetCollection(Type) GetCollection(Type)

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

(Inherited from ConfigurationElement)
GetMetadata(String) GetMetadata(String) GetMetadata(String) GetMetadata(String)

Returns metadata values from the element schema.

(Inherited from ConfigurationElement)
SetAttributeValue(String, Object) SetAttributeValue(String, Object) SetAttributeValue(String, Object) SetAttributeValue(String, Object)

Sets the value of the specified attribute.

(Inherited from ConfigurationElement)
SetMetadata(String, Object) SetMetadata(String, Object) SetMetadata(String, Object) SetMetadata(String, Object)

Sets metadata values from the element schema.

(Inherited from ConfigurationElement)
ToString() ToString() ToString() ToString()

Returns a string representation of the binding object.

Applies to