What is difference between UriKind.Relative and UriKind.Absolute?

Viewed 9077

What is difference between UriKind.Relative, UriKind.Absolute, and UriKind.RelativeOrAbsolute?

2 Answers

UriKind.Relative: Relative Uri would be "relative to the project's structure, with a forward-slash character / we're specifying the root from the project. Example:

new Uri("/index.html ", UriKind.Relative)

UriKind.Absolute: Absolute URIs are Complete url, which start with protocol name Example:

new Uri("http://www.testdomain.com/index.html ", UriKind.Absolute)

UriKind.RelativeOrAbsolute: in this case runtime will figure it out for itself and It will attempt to clean up the UriString we provide and figure out where resources are.

Related