Microsoft VBScript runtime error '800a01c9' This key is already associated with an element of this collection or Server object error 'ASP 0177 : 800a01c9' Server.CreateObject Failed The operation completed successfully. |
Some upload code (e.g. ASPSmartUpload and PureASP Upload) assign input type=file elements to an internal index / dictionary object. If you have multiple file elements with the same name, this error will occur--so fix your naming issue. This can also happen with older versions of Internet Explorer (5.0 or lower), which had problems encoding certain characters when committing an HTTP post. If this is the case, you may have to up your cutoff for support of legacy browsers.
You can also get this error if you are using Scripting.Dictionary and attempt to add a duplicate key. Try this code:
<% set dict = CreateObject("Scripting.Dictionary") dict.add "foo", "bar" dict.add "bar", "foo" ' ... dict.add "foo", "blat" %> |
So, make sure you are not adding duplicate keys. If you wish to replace a key that already exists, you can always do this:
if dict.Exists(key) then dict.Remove(key) dict.add key, val |
If you are populating a dictionary object from a recordset, make sure to use DISTINCT or GROUP BY so you can prevent duplicate keys. Or, better yet, use GetRows() or GetString() to more efficiently process the results (see
Article #2467).