System.Uri.IsBaseOf Method

Determines whether the current Uri instance is a base of the specified Uri instance.

Syntax

public bool IsBaseOf (Uri uri)

Parameters

uri
The specified Uri instance to test.

Returns

true if the current Uri instance is a base of uri; otherwise, false.

Remarks

Uri.IsBaseOf(Uri) is used to compare the current Uri instance to a specified Uri to determine whether this URI is a base for the specified Uri. When comparing two Uri objects to determine a base relationship, the user information (Uri.UserInfo) is not evaluated. When comparing two URIs (uri1 and uri2), uri1 is the base of uri2 if, when you ignore everything in uri2 after the last slash (/), the two URIs are identical. Using http://host/path/path/file?query as the base URI, the following table shows whether it is a base for other URIs.

http://host/path/path/file/

yes

http://host/path/path/#fragment

yes

http://host/path/path/MoreDir/"

yes

http://host/path/path/OtherFile?Query

yes

http://host/path/path/

yes

http://host/path/path/file

yes

http://host/path/path

no

http://host/path/path?query

no

http://host/path/path#Fragment

no

http://host/path/path2/

no

http://host/path/path2/MoreDir

no

http://host/path/File

no

Requirements

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