Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

UriBuilder.Port Property

Gets or sets the port number of the URI.

Namespace:  System
Assemblies:   System.Runtime.Extensions (in System.Runtime.Extensions.dll)
  System (in System.dll)

public int Port { get; set; }

Property Value

Type: System.Int32
The port number of the URI.

ExceptionCondition
ArgumentOutOfRangeException

The port cannot be set to a value less than -1 or greater than 65,535.

The port number defines the protocol port for contacting the host referenced in the URI. If a port is not specified as part of the URI, the Port property returns the value of -1 to indicate that the default port value for the protocol scheme will be used to connect to the host. If the Port property is set to a value of -1, this indicates that the default port value for the protocol scheme will be used to connect to the host.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8

Portable Class Library

Supported in: Portable Class Library
Show:
© 2015 Microsoft