Expand Minimize
This topic has not yet been rated - Rate this topic

SPSite.Port property

Gets the port number that is used for input and output on the virtual server that contains the site collection.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
public int Port { get; }

Property value

Type: System.Int32
A 32-bit integer that indicates the port number.

The following code example displays the port number for the specified site collection in a console application.

using (SPSite oSiteCollection = new SPSite("http://" + 
   System.Environment.MachineName))
{
    Console.WriteLine("port: " + oSiteCollection.Port.ToString());
}
Note Note

Certain objects implement the IDisposable interface, and you must avoid retaining these objects in memory after they are no longer needed. For information about good coding practices, see Disposing Objects.

Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.