Caution
This constructor has been deprecated; the dontEscape parameter is always false. Use Uri(Uri, string) instead.
Initializes a new instance of the Uri class based on the specified base and relative URIs, with explicit control of character escaping.
public:
Uri(Uri ^ baseUri, System::String ^ relativeUri, bool dontEscape);
[System.Obsolete("This constructor has been deprecated; the dontEscape parameter is always false. Use Uri(Uri, string) instead.")]
public Uri(Uri baseUri, string? relativeUri, bool dontEscape);
[System.Obsolete("The constructor has been deprecated. Please new Uri(Uri, string). The dontEscape parameter is deprecated and is always false. https://go.microsoft.com/fwlink/?linkid=14202")]
public Uri(Uri baseUri, string? relativeUri, bool dontEscape);
[System.Obsolete("The constructor has been deprecated. Please new Uri(Uri, string). The dontEscape parameter is deprecated and is always false. http://go.microsoft.com/fwlink/?linkid=14202")]
public Uri(Uri baseUri, string relativeUri, bool dontEscape);
public Uri(Uri baseUri, string relativeUri, bool dontEscape);
[System.Obsolete("The constructor has been deprecated. Please new Uri(Uri, string). The dontEscape parameter is deprecated and is always false. https://go.microsoft.com/fwlink/?linkid=14202")]
public Uri(Uri baseUri, string relativeUri, bool dontEscape);
[<System.Obsolete("This constructor has been deprecated; the dontEscape parameter is always false. Use Uri(Uri, string) instead.")>]
new Uri : Uri * string * bool -> Uri
[<System.Obsolete("The constructor has been deprecated. Please new Uri(Uri, string). The dontEscape parameter is deprecated and is always false. https://go.microsoft.com/fwlink/?linkid=14202")>]
new Uri : Uri * string * bool -> Uri
[<System.Obsolete("The constructor has been deprecated. Please new Uri(Uri, string). The dontEscape parameter is deprecated and is always false. http://go.microsoft.com/fwlink/?linkid=14202")>]
new Uri : Uri * string * bool -> Uri
new Uri : Uri * string * bool -> Uri
Public Sub New (baseUri As Uri, relativeUri As String, dontEscape As Boolean)
Parameters
The base URI.
The relative URI to add to the base URI.
true
if baseUri
and relativeUri
are completely escaped; otherwise, false
.
baseUri
is not an absolute Uri instance.
The URI formed by combining baseUri
and relativeUri
is empty or contains only spaces.
-or-
The scheme specified in the URI formed by combining baseUri
and relativeUri
is not valid.
-or-
The URI formed by combining baseUri
and relativeUri
contains too many slashes.
-or-
The password, host name, file name, or user name specified in the URI formed by combining baseUri
and relativeUri
is not valid.
-or-
The host or authority name specified in the URI formed by combining baseUri
and relativeUri
is terminated by backslashes.
-or-
The port number specified in the URI formed by combining baseUri
and relativeUri
is not valid or cannot be parsed.
-or-
The length of the URI formed by combining baseUri
and relativeUri
exceeds 65519 characters (.NET 9 and earlier versions only).
-or-
The length of the scheme specified in the URI formed by combining baseUri
and relativeUri
exceeds 1023 characters.
-or-
There is an invalid character sequence in the URI formed by combining baseUri
and relativeUri
.
-or-
The MS-DOS path specified in baseUri
doesn't start with c:\\.
The following example creates a new instance of the Uri class by combining the relative URIs http://www.contoso.com
and Hello%20World.htm
to form an absolute URI.
Uri baseUri = new Uri("http://www.contoso.com");
Uri myUri = new Uri(baseUri, "Hello%20World.htm",false);
let baseUri = Uri "http://www.contoso.com"
let myUri = Uri(baseUri, "Hello%20World.htm", false)
Dim baseUri As New Uri("http://www.contoso.com")
Dim myUri As New Uri(baseUri, "Hello%20World.htm", False)
Remarks
This constructor creates a Uri instance by combining baseUri
and relativeUri
. If the URI passed in relativeUri
is an absolute URI (containing a scheme, host name, and optionally a port number), the Uri instance is created using only relativeUri
.
The dontEscape
parameter controls whether reserved characters are translated into escape sequences. This parameter should be set to true
only if you are certain that all reserved characters in the URI have been escaped. Setting the value to true
for a URI that has not been completely escaped can cause unexpected behavior. It is strongly recommended that you always set this parameter to false
. If dontEscape
is set to false
, the constructor escapes any reserved characters by checking that all occurrences of percent (%) are followed by a valid escape sequence. If the character sequence following a percent is not valid, the percent is replaced by %25.
This constructor does not ensure that the Uri refers to an accessible resource.
Notes to CallersBecause of security concerns, your application should not call this constructor with URI strings from untrusted sources and with dontEscape
set to true
. Alternately, you can check a URI string for validity by calling the IsWellFormedOriginalString() method prior to calling this constructor.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4