Strange behavior in Uri-class (.NET)

Why does the Uri class urldecode my url that I send to its contructor and how can I prevent this?

Example (look at the querystring value "options"):

    string url = "http://www.example.com/default.aspx?id=1&name=andreas&options=one%3d1%26two%3d2%26three%3d3";
    Uri uri = new Uri(url); // http://www.example.com/default.aspx?id=1&name=andreas&options=one=1&two=2&three=3

Update:

// ?id=1&name=andreas&options=one%3d1%26two%3d2%26three%3d3
Request.QueryString["options"] = one=1&two=2&three=3

// ?id=1&name=andreas&options=one=1&two=2&three=3
Request.QueryString["options"] = one=1

This is my problem :)

Answers


why exactly? you can get to the encoded version using url.AbsoluteUri

EDIT

Console.WriteLine("1) " + uri.AbsoluteUri);
Console.WriteLine("2) " + uri.Query);

OUT:
1) http://www.example.com/default.aspx?id=1&name=andreas&options=one%3d1%26two%3d2%26three%3d3
2) ?id=1&name=andreas&options=one%3d1%26two%3d2%26three%3d3

Need Your Help

Implicit resolution for different orders of case class and companion

scala implicit case-class companion-object context-bound

Usually, I write first a case class and then the companion object in the same file, right below. But when trying to import an implicit declared in the companion, I'm forced to switch the order of