Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7812411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:29:40+00:00 2026-06-02T04:29:40+00:00

Sample Code: Dim myObject Set myObject = JSON.parse(someJsonResponseFromTheServer) myFunction(myObject.someProperty) The Problem: When code similiar

  • 0

Sample Code:

Dim myObject
Set myObject = JSON.parse(someJsonResponseFromTheServer)    

myFunction(myObject.someProperty)

The Problem:

When code similiar to this is ran in my application, it throws a 500 error from the server with a message similar to “Object Does not support property or method ‘someProperty’. What I would like to do to solve this problem is something like this:

Dim myObject
Set myObject = JSON.parse(someJsonResponseFromTheServer)    

If myObject.someProperty Then
    myFunction(myObject.someProperty)
End If

However, if I add the conditional, it throws the same error on the line with the conditional instead of the line with the method call.

My Question:

In ASP Classic, how do you detect if a property exists within an object without throwing an error?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T04:29:42+00:00Added an answer on June 2, 2026 at 4:29 am

    One of the benefits of classic ASP is that it allows you to run both VBScript and JScript in the same page – thus you can use the power of both.

    First, add this block of JScript code to your existing .asp file:

    <script language="JScript" runat="server">
    function CheckProperty(obj, propName) {
        return (typeof obj[propName] != "undefined");
    }
    </script>
    

    And assuming VBScript is the default language in the page, you can call it from within your VBScript code like this:

    Dim myObject
    Set myObject = JSON.parse(someJsonResponseFromTheServer)    
    If CheckProperty(myObject, "someProperty") Then
        myFunction(myObject.someProperty)
    End If
    

    Tested it with generic class object and it works fine – the JScript is compiled before the VBScript thus accessible to it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i've a huge problem. Take a look to this sample code private sub FUNCTION1()
In sample code, I have seen this: typedef enum Ename { Bob, Mary, John}
SAMPLE CODE: Dim sql As String = SELECT * FROM + tblName + WHERE
In one of the WCF tutorials, I saw the following sample code: Dim service
This link offers sample code to infer the schema of an XML file, in
I am trying to do something similar to this sample code from Phil Haack
I have the following sample code in a VB.NET console application. It compiles and
I have a fairly simple Linq query (simplified code): dim x = From Product
I have a simple text reading code for Visual Basic: Dim fileReader As String
Sample code: public class Service1 { public int Service1() { .... } } public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.