0 Replies - 988 Views - Last Post: 12 June 2007 - 05:16 AM

#1 Chubber  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 131
  • Joined: 16-October 06

QueryStringToDictionary

Posted 12 June 2007 - 05:16 AM

Description: Used for returning a dictionary object (like the Request Object) when dealing with a string encoded as a querystring is. I use this to pass data between web services. Return a dictionary object built from the query string
Function QueryStringToDictionary(strIn)
     'Return a dictionary object built from the query string
     'If Trim(strIn) = "" Then 
     '     Set QueryStringToDictionary = Nothing
     '     Exit Function
     'End If
     Dim arAddr, arKeyValue, I
     On Error Resume Next
     Set QueryStringToDictionary=Server.CreateObject("Scripting.Dictionary")
     If Err.Number <> 0 Then
          Set QueryStringToDictionary = Nothing
          Exit Function
     End If
     On Error Goto 0
     arAddr = Split(strIn, "&")
     For I = LBound(arAddr) To UBound(arAddr)
          arKeyValue = Split(arAddr(I), "=")
          If UBound(arKeyValue) >= 1 Then
               QueryStringToDictionary.Add arKeyValue(0), arKeyValue(1)
          ElseIf UBound(arKeyValue) = 0 Then
               QueryStringToDictionary.Add arKeyValue(0), ""
          Else
          End If
     Next 'I
End Function


Is This A Good Question/Topic? 0
  • +

Page 1 of 1