I wrote a neat little open source library for this kind of thing. Check out WebBuddy and in particular UriBuddy . The binaries are for Silverlight, but you can easily browse the source and rip everything you need.
Here is what you would call UriBuddy:
// Take a base url Uri sample = new Uri("http://www.nytimes.com"); // some highly useful parameters Dictionary<String, String> query = new Dictionary<string, string> { {"param1","nice"}, {"param2","code man"} }; // create a new url using a chained style of coding Uri newSample = sample .AppendPath("/pages/world") .AppendQueryValues(query);
By the way, I never had to do such things outside of Silverlight. I am sure that the βrealβ .NET library has built-in functions that are very similar to mine.
source share