Mono Class Library: System.Uri Overview | Members

System.Uri.Port Property

Gets the port number used to connect to the Uri.Host referenced by the current instance.

public int Port { get; }

Value

A int containing the port number, or -1 if no port is used by the URI Uri.Scheme . If no port was specified as part of the URI used to construct the current instance, the Uri.Port property returns the default port for the URI scheme.

Remarks

This property is read-only.

Note:

The following table lists the default port number for each supported scheme.

SchemePort
file-1
ftp21
gopher70
http80
https43
mailto25
news119
nntp119

Requirements

Namespace: System
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0