ASP Session with VB 6 problem

On a WinNT 4 platform (using Visual Basic 6 and ADO) we had used

    Session("VW") = r!VW_NF

Now we are using Windows 2000.
That code, shown above, now raises "No default property for object."  
If I paste the statement into the debug window though, it runs without error.
If I modify it to be

    Session("VW") = CStr(r!VW_NF)

it runs properly.

OK.  So I found a work-around.  
But now, I have a worse problem.

We have a class that is just a set of properties (let’s call it clsXXX):

Public Value1 As String
Public Value2 As String
 . . .
Public Val__n As String

In (for example) ThePage_Respond(), we have

    Dim ob As clsXXX
    Set ob = New clsXXX

    GetValues ob    ' This fills the properties.  This Sub is not part of the class, it only fills in the object’s properties

    Set Session("XXX") = ob    '  <——<<<
    Set Session("XXX") = Nothing

At the line marked by the arrow, nothing happens.
The Watch window shows that Session("XXX") is still Variant/Empty.

I need to be able to store objects in the Session.

Is there some flaw in the Windows 2000 environment that cripples Internet Information Server’s ASP objects (Server, Application, Request, Response & Session)?
Are there other issues I am going to run into?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Have you tried using the code behind to handle these values rather than trying to stuff them all in a session variable?

Do not place an object in session.

Here some links ....(applicable to also)


What you CAN do is change the object to a string and change your function that filles it to create a delimited string.  They you will need a function to parse out and read it.

Much better to use separate variables for what you need.

Or use code behind
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

BrianWrenAuthor Commented:
In a VB IIS application, your HTML contains replaceable tags.  In your VB project, you specify the signature of these tags.  Default is WC@, but the books recommend changing that.  We use WC.

So when the VB encounters <WC_ while processing an html template, it calls the [templateName]_ProcessTag(ByVal TagName As String, TagContents As String, SendTags As Boolean) Sub, filling in the TagName argument with all that is between the < and >, and filling in the TagContents with all that is between the <WC_...> and </WC_...> tags.

With <WC_Name>-default-</WC_Name> the function would be called with TagName = "WC_Name" and TagContents = "-default".

When processing a request for a template, first the [templateName]_Respond() sub is called, and when that sub has [templateName].WriteTemplate, the [templateName]_ProcessTag() Sub is called once for each replaceable tag.  Whatever the value of TagContents is when the sub ends, that value will replace the whole tag in the resultant web page.

I have some cases where I fill in 80 or 90 separate values on the page, all of which come from an Oracle DB.  
I don't want to open that record 80 or 90 times.
I tried using a UDT but that cannot be done because it requires late binding, and an IIS project with even one instance of late binding won't compile.

We switched to using classes, because that facilitates early binding.  (You can cause late binding of classes or early binding.  There is no way to use early binding with User-Defined Types in VB/IIS.)

In the Respond routine we get the values then close the recordset, and in the ProcessTag routine we use the exposed parts of the class to fill in the values on the page:

Private Sub [templatename]_ProcessTag( ..., ... )

    Dim ob As clsWhatever
    Set ob = Session("Whatever I Stored The Object As")

    Select Case Lcase$(TagName)
        Case "wc_name":         TagContents = ob.Name
        Case "wc_addr":         TagContents = ob.Addr
        Case "wc_ ...":
    End Select

    Set ob = Nothing

End Sub

Doing this with individual variables in the Session would be a big mess.
This ran on our WinNT, IIS 4, VB 6 (SP 5) network, but does not on our Win2K

Additionally, no one has addressed the issue that

    Session("VW") = r!VW_NF

ran before, but requires

    Session("VW") = CLngr!VW_NF)

now.  This isn’t an issue of storing objects in the Session, but it still fails to fly.

Part of the reason we had to innovate this is that, whereas this could easily have been done in an .EXE with a global object, that won't fly in IIS.  Global object belong to everyone making a request, and this needed to have user-by-user resolution.

riyasjef, those links were informative.  They were largely focused on storing objects to re-use between requests, and we aren't doing that in this code I'm focusing on.  (I do do that in one place, and that might turn out to be disastrous later, but the topics of those links seem to be slightly to the side of this particular problem, especially considering that I have difficulty assigning a recordset field’s value to a simple Session item.

BrianWrenAuthor Commented:
I believe the answer to this can be found in

It has to do with security, and the situation when debugging VB in the IDE.

The ASP session is under the user IWAM_<machine-name>, but the IDE is under the account of the developer.  Since the COM+ objects are instantiated by one of these ‘users,’ the ‘user’ associated with the IDE cannot gain access to the objects belonging to IWAM_<machine-name>, and vice verse.

PAQed with points refunded (500)

Community Support Moderator

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.