Uri doesn't construct with certain URI's

  • Thread starter Thread starter PlayerGiro
  • Start date Start date
P

PlayerGiro

Here is a valid URI according to the RFC:

magnet:?xt=urn:sha1:YNCKHTQCWBTRNJIV4WNAE52SJUQCZO5C

However the following code throws an exception:

System.Uri u = new System.Uri(magnet:?xt=urn:sha1:YNCKHTQCWBTRNJIV4WNAE52SJUQCZO5C);

I'll bet it's because there's no forward-slashes after the colon.
However forward slashes are only for hierarchical namespaces (e.g.,
URLS).

Is this class a misnomer? Maybe it should be renamed URL? Or am I
missing something?
 
I just tried your example, except that I enquoted the constructor argument,
and it worked fine.

- J
 
Back
Top