Home Blog Others Object Doesn't support this property or method on automatically generated property
Object Doesn't support this property or method on automatically generated property
Others
Written by Dicky   
Wednesday, 29 June 2011 08:29
AddThis Social Bookmark Button

If you use classic ASP and JSON object to auto-generate your property. You might come to this error "Object Doesn't support this property or method" when trying to access the object property. I have tried IsNull() IsObject(), Is Nothing keyword and none of them is working.

The best way to handle the error is by handling the error, makes a lot of sense I guess!? So say that you want to access property .color from your Car JSON object. When you try to access Car.color, if the color property doesn't exists, it will give you that error. Here's what you can do:

 ' change error handling to carry on in error
on error resume next
' get the property
dim color: color = Car.color
if err.number <> 0
    'do something (or nothing)
    err.clear
end if
' reset error handling
on error goto 0

That way the code will continue to execute without error and we can go on with our life!