Yet another odd .NET 1.1 and .NET 2.0 quirk
Tonight, we discovered a slight issue when using FeedBurner's click tracking along with Community Server v2.1. After digging into it, I quickly saw the issue, but then as I went a little deeper, realized it was more deceiving than I'd thought.
There seems to be a slight difference in the Uri class between .NET v1.1 and .NET v2.0. One new property in 2.0 is the "OriginalString", which gives you the original value that was used to construct the Uri.
FeedBurner's click tracking works by using URLs like this: http://feeds.qgyen.net/~r/krobertson/~3/http%3A%2F%2Fqgyen.net%2Farchive%2F2006%2F07%2F11%2FSome-changes-around-here.aspx
The part that gets screwed up is the "%3A%2F%2F", which when url decoded is "://". In .NET 2.0, the Uri class will collapse this to ":/", which is not the valid url.
To illustrate the issue with a simple, three line code sample, open up both Visual Studio 2003 and Visual Studio 2005, create a console application in both, and paste the following code. Set breakpoint, and you'll see the difference:
string orig = @"http://feeds.qgyen.net/~r/krobertson/~3/http%3A%2F%2Fqgyen.net%2Farchive%2F2006%2F07%2F11%2FSome-changes-around-here.aspx";
Uri uri = new Uri(orig);
string back = uri.ToString();
When you run this code, you'll find the the value of back is as follows:
.NET 1.1 = "http://feeds.qgyen.net/~r/krobertson/~3/http://qgyen.net/archive/2006/07/11/Some-changes-around-here.aspx"
.NET 2.0 = "http://feeds.qgyen.net/~r/krobertson/~3/http:/qgyen.net/archive/2006/07/11/Some-changes-around-here.aspx"
One of these is not like the other. So, is this expected behavior? Common sense tells me no, which leads me to think this is a bug in the .NET 2.0 framework.
So basically, as the code is now, it'll work under ASP.NET v1.1, but not ASP.NET 2.0. The fix for ASP.NET 2.0 uses a property that isn't in ASP.NET 1.1, the code isn't providerized, and using reflection to handle it could break medium trust compatibility. Ahh, the joys of version incompatibilities.