Port Property

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Gets the port number of this URI.

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

member Port : int

Property Value

Type: System..::..Int32
An Int32 value that contains the port number for this URI.

ExceptionCondition
InvalidOperationException

This instance represents a relative URI, and this property is valid only for absolute URIs.

The port number defines the protocol port used for contacting the server referenced in the URI. If a port is not specified as part of the URI, the Port property returns the default value for the protocol. If there is no default port number, this property returns -1.

Show: