Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing Application Object from a VB Dll...

Status
Not open for further replies.

sweta

Programmer
Apr 1, 2003
35
0
0
IN
Hi there,

I've written a Dll using VB, which accesses an application object created in global.asa with <OBJECT> tag.

<OBJECT RUNAT=Server
SCOPE=Application
ID=Users
PROGID=&quot;Scripting.Dictionary&quot;>
</OBJECT>

I add elements to the 'User' object using the staticobjects collection of the application object. The function for adding is as follows:

Function addUser(user)

user.id = &quot;ID&quot; & CLng(Timer * 1000)

user.name=name

' add user to Application object 'Users'
objApplication.StaticObjects.Item(&quot;Users&quot;).Add user.id, user.name

' return user with updated information
Set addUser = user
End Function ' // > Function addUser

But actually it doesn't refer to the Application Object 'Users'. I added a few elements to the Users object in my Dll. I was expecting the Users object to contain those values but when I tried to count the no. of elements in the Users object from my ASP script, I came to know that the data was actually not added and the User object had no elements added to it.

Can anybody tell me what's wrong with my code.

Thanx,
Sweta



 
You have to be more specific, but as i knw you cant access ASP built in Objects.

________
George, M
 

Hi Shaddow,

You can always access ASP built in objects from VB using the Object Context Object. In fact you can build an entire ASP application using VB alone and lil' bit of ASP.

In fact I have done it too many times. This time I found the the behavior lil' strange.Anyways...

Thanx,
Sweta

 
Ok now since i just find out something new, actually never looked for ObjectContext Object more then ASP.

I remember i had same problems using Scripting.Dictionary objects inside Application object exactly for same reason as you do now, keeping a track for users.
It didnt work but i didnt get any error, then i made some reading ( about 2 years ago), i think it was a Tek article and i find out that Application cant store some kind of objects that are not Thread Safe or something like that. Scripting.Dictionary it's not Thread Safe.

Instead i've used the Application itself to store the users, since Application and Session can have Keys and Values(acts like a scripting object), this way it worked

Hope this will solve your problem

________
George, M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top