Peter
Peter

Reputation: 38515

.net Uri case sensitivity

Well lets say we have the following 2 uri's

Uri uri1 = new Uri(@"http://localhost/test/");
Uri uri2 = new Uri(@"http://localhost/TEst/test123/");
Uri relativeUri = uri1.MakeRelativeUri(uri2);

the relativeUri holds the following value "../TEst/test123/"

i wanted the value "test123/"

So is there any way to make uri's not case sensitive?

Upvotes: 1

Views: 2564

Answers (1)

Oded
Oded

Reputation: 499132

Lower case the string before constructing the URI:

Uri uri2 = new Uri(@"http://localhost/TEst/test123/".ToLowerInvariant());

Upvotes: 4

Related Questions