Partager via


UriBuilder.Port Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets the port number of the URI.

Namespace:  System
Assembly:  System (in System.dll)

Syntax

'Declaration
Public Property Port As Integer
public int Port { get; set; }

Property Value

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

Exceptions

Exception Condition
ArgumentOutOfRangeException

The port number cannot be set to less than 0 or greater than 65,535.

Remarks

The port number defines the protocol port for contacting the server referenced in the URI. If a port is not specified as part of the URI, the Port property returns the value -1 to indicate that the server uses the default value for the protocol.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

See Also

Reference