using System; public class Test { public static void Main() { var baseUrl = new System.Uri("http://w...content-available-to-author-only...g.com"); var builder = new System.UriBuilder(baseUrl); string name = "param"; string val = "{'blah'}"; builder.Query = name + "=" + val; // Try several different ouput methods Console.WriteLine(builder.ToString()); Console.WriteLine(builder.Uri.ToString()); Console.WriteLine(builder.Query); // Shouldn't the {, }, and '}' characters be URLEncoded? I expected the // output to be %7B%27blah%27%7D // The System.UriBuilder.Querey docs say that // "The query information is escaped according to RFC 2396" // http://msdn.microsoft.com/en-us/library/system.uribuilder.query(v=vs.110).aspx // You can test our URL encoding of these characters using a web tool like // http://m...content-available-to-author-only...b.com/eric/tools/dencoder/ // or using JavaScript's encodeURI: http://j...content-available-to-author-only...e.net/7wgtJ/ // or using a C# class--but unfortunately both HttpServerUtility and // WebUtility, which provide URL encoding, seem unavailable in ideone. } }