SPIisWebSite.ServerBindings Property
Gets or sets a list of server bindings that are served by the Internet Information Services Web site.
Namespace: Microsoft.SharePoint.Administration
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
Syntax
'Declaration
Public Property ServerBindings As String()
Get
Set
'Usage
Dim instance As SPIisWebSite
Dim value As String()
value = instance.ServerBindings
instance.ServerBindings = value
public string[] ServerBindings { get; set; }
Property Value
Type: []
A string array that contains the list of server bindings.
Remarks
A SPServerBinding object is a string that IIS uses to determine which network endpoints are used by the server instance. Use an indexer to return a single server binding from the collection. The string format is IP: Port: Hostname.
Examples
This example instantiates an SPIisWebSite object to access the server bindings for the local SharePoint Foundation farm. If there is neither an IP address nor a hostname for the SPIisWebSite object, that portion of the string that represents the server bindings is null.
[C#]
SPSite oSiteCollection = new SPSite("https://localhost");
Uri uri = new Uri(oSiteCollection.Url);
SPWebApplication webApp = SPWebApplication.Lookup(uri);
int instID = webApp.IisSettings[SPUrlZone.Default].PreferredInstanceId;
SPIisWebSite iisWebSite = new SPIisWebSite(instID);
Console.WriteLine("*>>> SPIISWebsite Instance Id " + iisWebSite.InstanceId);
Console.WriteLine("*>>> Server Bindings " + iisWebSite.ServerBindings);
string [] sb = iisWebsite.ServerBindings;
foreach (string strServerBinding in sb) {
Console.WriteLine("Binding is " + strServerBinding);
}
See Also
Reference
Microsoft.SharePoint.Administration Namespace
Other Resources
Setting Server Bindings Using System.DirectoryServices