System.Web.HttpValueCollection parsing and ToString not reversible - by Paulo Morgado

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 355774 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 7/10/2008 2:49:42 PM
Access Restriction Public


HttpValueCollection.FillFromString(string s, bool urlencoded, Encoding encoding) parsing does not have the reverse behavior of HttpValueCollection.ToString()
Sign in to post a comment.
Posted by Microsoft on 7/15/2009 at 2:50 PM
Thaks Paulo, we have certainly considered this, we are however unable to release a hotfix for this issue in shipping versions of ASP.NET 3.5 SP1 and below at this point.
Posted by Paulo Morgado on 7/7/2009 at 2:49 PM

However, I see this as a bug and would like to see it fixed in previous versions also.
Posted by Microsoft on 7/1/2009 at 10:56 AM
Thanks for the report. And apologies it's taken so long to get back to you on this. You will see this fix starting in ASP.NET 4 Beta 1.

HttpValueCollection.FillFromString() differentiates between null and empty keys. Parsing "value" would generate a null key, while parsing "=value" would generate an empty key. However, HttpValueCollection.ToString() does not differentiate between null and empty keys:

    keyPrefix = (!String.IsNullOrEmpty(key)) ? (key + "=") : String.Empty;

The fix wasto insert "=" for empty keys but nothing for null keys, like so:

    keyPrefix = (key != null) ? (key + "=") : String.Empty;
Posted by Paulo Morgado on 8/7/2008 at 5:33 PM
Fixed, how?
Posted by Paulo Morgado on 7/14/2008 at 4:58 PM
Posted by Microsoft on 7/11/2008 at 2:10 AM
Thanks for your feedback. We are escalating this bug to the product unit who works on that specific feature area. The team will review this issue and make a decision on whether they will fix it or not for the next release.

Thank you,
Visual Studio Product Team