Home Dashboard Directory Help
Search

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


Status: 

Closed
 as Fixed Help for as Fixed


3
0
Sign in
to vote
Type: Bug
ID: 355774
Opened: 7/10/2008 2:49:42 PM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

HttpValueCollection.FillFromString(string s, bool urlencoded, Encoding encoding) parsing does not have the reverse behavior of HttpValueCollection.ToString()
Details
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
Thanks.

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
http://msmvps.com/blogs/paulomorgado/archive/2008/07/14/beware-system-web-httpvaluecollection-parsing-is-not-reversible.aspx
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
Sign in to post a workaround.