devxlogo

ActiveX Control to read URL properties

ActiveX Control to read URL properties

Question:
I have a VB database application that, when I pass a unique id to a client object, opens that record (this explanation is simplified). I have to write an ActiveX control of some type that accepts a URL, so I can parse out what I need and pass it to the control?which then calls my database application.

I need it to be a client-side control because my database app runs on the client. The reason for passing the record id as a URL is that the message is generated on a seperate server and is mailed to the user.

So, what do I need to do to enable an ActiveX control to see the URL that called it (and is it possible to parse out the contents of the URL)? My other thought was to create parameters on the control and set them when the page is called, but I don’t know how to do that.

Answer:
From your question, I gather you are passing a URL with a primary key that is being passed to a Web server which returns a page containing an ActiveX control. You would like the ActiveX Control to look up a record from a database based on the primary key passed into the page. A simple solution is to place the control in an ASP page. The ASP page’s Request object has a QueryString property that returns the query string part of the URL.

In order to parse the query string to return on a specific namevalue pair you can pass the name of the pair to the QueryString property. For example, suppose the URL is www.Flashcreative.comsome.asp?name=mike&id=123. In the ASP page you can retrieve the value of the id variable with Response.Querystring(“id”). Once you’ve retrieved the value of the Primary key, you can simply set the property of the control within the HTML that is sent to the browser.

See also  Professionalism Starts in Your Inbox: Keys to Presenting Your Best Self in Email
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist