Gets the name of the server that hosts the site collection.
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online
When used in conjunction with an SPSite constructor, the HostName property contains a different value depending on the URL that is passed to the constructor. For example, if "http://" + System.Environment.MachineName is passed as the URL, the HostName property contains the name of the computer that is running SharePoint Foundation, but if http://localhost is passed as the URL, then the property contains "localhost".