Bug in System.Uri constructor?

S

serious-sam

Hello all,

I'm using the System.Uri class to clean up some the URLs we're
passing around, e.g. compacting http://hostname//somefolder//somefile
to http://hostname/somefolder/somefile.

The documentation clearly states that the Uri constructor takes care
of this: http://msdn2.microsoft.com/en-us/library/system.uri.aspx

This works fine on my machine. However, when I try this on our
server box (Win 2003), I just get back the string I passed to the
constructor.

I've checked the .NET versions and the assembly versions on both the
target machine and my workstation. They match.

Here's the code:

using System;

namespace sandpit
{
class Program
{
public static void Main(string[] args)
{
Type type = typeof(Uri);
Console.WriteLine(type.ToString());
Console.WriteLine(type.Assembly);
Console.WriteLine(type.AssemblyQualifiedName);
Console.WriteLine(type.UnderlyingSystemType);
Uri uri = new Uri(args.Length == 0 ? "http://hostname///
somefile.txt" : args[0]);
Console.WriteLine(uri.ToString());
}
}
}

Can someone suggest what might be happening here? I'm a little
puzzled.

Cheers,
Misha
 
S

serious-sam

Well, it's been over a week. I still haven't been able to find out a
reason why this is so. A colleagues have reported the same thing
happening as well. For the time being, I'm going to accept that this
just doesn't work, and opt to scrub URLs manually instead.

Sam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top