Lee Kelleher

Archive for posts dated '06 June 2008'

  1. June 2008

    1. Making Request.QueryString writable (by clone/copy)

      Posted on . Estimated read time: under a minute (102 words)

      Every now and then I completely forget that the Request.QueryString (and Request.Form) object is read-only. Today I had a bit of functionality where I needed to remove a key/value from the collection - but the Remove() method (of the NameValueCollection object) throws an exception. Unfortunately, the Request.QueryString's CopyTo method assigns the values to an ARRAY, not a NameValueCollection - losing functionality and flexibility. You need to copy the Request.QueryString object to a new NameValueCollection instance,…

      Tags: , , , ,

    2. How to convert NameValueCollection to a (Query) String

      Posted on . Estimated read time: under a minute (132 words)

      Most ASP.NET developers know that you can get a key/value pair string from the Request.QueryString object (via the .ToString() method). However that functionality isn't the same for a generic NameValueCollection object (of which Request.QueryString is derived from). So how do you take a NameValueCollection object and get a nicely formatted key/value pair string? (i.e. "key1=value1&key2=value2") ... Here's a method I wrote a while ago: /// <summary> /// Constructs a QueryString (string). /// Consider this method…

      Tags: , , , ,

Year archive

  1. 2018
    1. January
    2. August
    3. November
  2. 2016
    1. March
    2. May
    3. June
    4. July
    5. August
    6. September
    7. October
  3. 2014
    1. March
    2. May
    3. November
  4. 2013
    1. September
    2. October
    3. November
    4. December
  5. 2012
    1. February
  6. 2011
    1. January
    2. June
    3. July
    4. September
    5. October
  7. 2010
    1. January
    2. April
    3. May
    4. August
  8. 2009
    1. January
    2. February
    3. April
    4. June
    5. July
    6. September
    7. October
    8. November
  9. 2008
    1. January
    2. February
    3. March
    4. April
    5. May
    6. June
    7. July
    8. August
    9. November
    10. December
  10. 2007
    1. January
    2. February
    3. March
    4. April
    5. May
    6. June
    7. July
    8. November
    9. December
  11. 2006
    1. March
    2. April
    3. June
    4. August
    5. September
    6. October
    7. November
    8. December

Tag archive

View all tags.