By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,720 Members | 2,237 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,720 IT Pros & Developers. It's quick & easy.

Error Displyaing Session Variables

P: n/a
I'm using this code:

Dim strName
For Each strName in Session.Contents
Response.Write strName & " - " & Session.Contents(strName) & "<BR>"
Next

If I only do a response.write strName, it shows all the session names
but when I include the session.contents it gives me the following
error:

Microsoft VBScript runtime error '800a01c2'

Wrong number of arguments or invalid property assignment

I've been to http://www.aspfaq.com/show.asp?id=2373 and it talks about
using ADODB.Recordset but I'm not accessing data on this page.

Any ideas why this is happening?

Thanks,

--
Jerry

Jul 21 '06 #1
Share this Question
Share on Google+
11 Replies


P: n/a

Jerry wrote:
I'm using this code:

Dim strName
For Each strName in Session.Contents
Response.Write strName & " - " & Session.Contents(strName) & "<BR>"
Next

If I only do a response.write strName, it shows all the session names
but when I include the session.contents it gives me the following
error:

Microsoft VBScript runtime error '800a01c2'

Wrong number of arguments or invalid property assignment

I've been to http://www.aspfaq.com/show.asp?id=2373 and it talks about
using ADODB.Recordset but I'm not accessing data on this page.

Any ideas why this is happening?
http://www.aspfaq.com/show.asp?id=2524

--
Mike Brind

Jul 21 '06 #2

P: n/a

Mike Brind wrote:
Jerry wrote:
I'm using this code:

Dim strName
For Each strName in Session.Contents
Response.Write strName & " - " & Session.Contents(strName) & "<BR>"
Next

If I only do a response.write strName, it shows all the session names
but when I include the session.contents it gives me the following
error:

Microsoft VBScript runtime error '800a01c2'

Wrong number of arguments or invalid property assignment

I've been to http://www.aspfaq.com/show.asp?id=2373 and it talks about
using ADODB.Recordset but I'm not accessing data on this page.

Any ideas why this is happening?

http://www.aspfaq.com/show.asp?id=2524
Thanks Mike.

I tried the example and I get the following error:

Microsoft VBScript runtime error '800a01f4'

Variable is undefined: 'Item'

So I added Dim Item and I get the original error messgae again:

Microsoft VBScript runtime error '800a01c2'

Wrong number of arguments or invalid property assignment

--
Jerry

Jul 21 '06 #3

P: n/a

"Jerry" <je*******@gmail.comwrote in message
news:11*********************@75g2000cwc.googlegrou ps.com...
>
Mike Brind wrote:
Jerry wrote:
I'm using this code:
>
Dim strName
For Each strName in Session.Contents
Response.Write strName & " - " & Session.Contents(strName) &
"<BR>"
Next
>
If I only do a response.write strName, it shows all the session names
but when I include the session.contents it gives me the following
error:
>
Microsoft VBScript runtime error '800a01c2'
>
Wrong number of arguments or invalid property assignment
>
I've been to http://www.aspfaq.com/show.asp?id=2373 and it talks about
using ADODB.Recordset but I'm not accessing data on this page.
>
Any ideas why this is happening?
>
http://www.aspfaq.com/show.asp?id=2524

Thanks Mike.

I tried the example and I get the following error:

Microsoft VBScript runtime error '800a01f4'

Variable is undefined: 'Item'

So I added Dim Item and I get the original error messgae again:

Microsoft VBScript runtime error '800a01c2'

Wrong number of arguments or invalid property assignment

--
Jerry
The code you have posted is correct assuming that Session and Response are
what we think they are and it is this code that is actually producing the
error and not something else.

Which version of IIS are we talking about?


Jul 21 '06 #4

P: n/a

Anthony Jones wrote:
"Jerry" <je*******@gmail.comwrote in message
news:11*********************@75g2000cwc.googlegrou ps.com...

Mike Brind wrote:
Jerry wrote:
I'm using this code:

Dim strName
For Each strName in Session.Contents
Response.Write strName & " - " & Session.Contents(strName) &
"<BR>"
Next

If I only do a response.write strName, it shows all the session names
but when I include the session.contents it gives me the following
error:

Microsoft VBScript runtime error '800a01c2'

Wrong number of arguments or invalid property assignment

I've been to http://www.aspfaq.com/show.asp?id=2373 and it talks about
using ADODB.Recordset but I'm not accessing data on this page.

Any ideas why this is happening?

>
http://www.aspfaq.com/show.asp?id=2524
Thanks Mike.

I tried the example and I get the following error:

Microsoft VBScript runtime error '800a01f4'

Variable is undefined: 'Item'

So I added Dim Item and I get the original error messgae again:

Microsoft VBScript runtime error '800a01c2'

Wrong number of arguments or invalid property assignment

--
Jerry

The code you have posted is correct assuming that Session and Response are
what we think they are and it is this code that is actually producing the
error and not something else.

Which version of IIS are we talking about?
IIS 5.1

If I remove the session(Item) part, it will list the session names.

Dim Item
For Each Item in Session.Contents
Response.Write Item & "<BR>"
Next

Jul 21 '06 #5

P: n/a
Jerry wrote:
I'm using this code:

Dim strName
For Each strName in Session.Contents
Response.Write strName & " - " & Session.Contents(strName) & "<BR>"
Next

If I only do a response.write strName, it shows all the session names
but when I include the session.contents it gives me the following
error:

Microsoft VBScript runtime error '800a01c2'

Wrong number of arguments or invalid property assignment

I've been to http://www.aspfaq.com/show.asp?id=2373 and it talks about
using ADODB.Recordset but I'm not accessing data on this page.

Any ideas why this is happening?

Thanks,
I've never used Session.Contents, but it should work. This is what I always
do:

For Each strName in Session
Response.Write strName & " - " & Session(strName) & "<BR>"
Next
Anyways, if you create a page containing only the snip of code you've posted
above, will the error occur?

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 21 '06 #6

P: n/a

Bob Barrows [MVP] wrote:
Jerry wrote:
I'm using this code:

Dim strName
For Each strName in Session.Contents
Response.Write strName & " - " & Session.Contents(strName) & "<BR>"
Next

If I only do a response.write strName, it shows all the session names
but when I include the session.contents it gives me the following
error:

Microsoft VBScript runtime error '800a01c2'

Wrong number of arguments or invalid property assignment

I've been to http://www.aspfaq.com/show.asp?id=2373 and it talks about
using ADODB.Recordset but I'm not accessing data on this page.

Any ideas why this is happening?

Thanks,

I've never used Session.Contents, but it should work. This is what I always
do:

For Each strName in Session
Response.Write strName & " - " & Session(strName) & "<BR>"
Next
Anyways, if you create a page containing only the snip of code you've posted
above, will the error occur?
Yes, an ASP page with only the following:
<%
Dim Item
For Each Item in Session.Contents
Response.Write Item & " - " & Session(Item) & "<BR>"
Next
%>
produces the same error.

If I remove the .Contents then I get the following error:
Microsoft VBScript runtime error '800a01b6'
Object doesn't support this property or method
/trs/test.asp, line 3

Jul 21 '06 #7

P: n/a

Jerry wrote:
Bob Barrows [MVP] wrote:
Jerry wrote:
I'm using this code:
>
Dim strName
For Each strName in Session.Contents
Response.Write strName & " - " & Session.Contents(strName) & "<BR>"
Next
>
If I only do a response.write strName, it shows all the session names
but when I include the session.contents it gives me the following
error:
>
Microsoft VBScript runtime error '800a01c2'
>
Wrong number of arguments or invalid property assignment
>
I've been to http://www.aspfaq.com/show.asp?id=2373 and it talks about
using ADODB.Recordset but I'm not accessing data on this page.
>
Any ideas why this is happening?
>
Thanks,
I've never used Session.Contents, but it should work. This is what I always
do:

For Each strName in Session
Response.Write strName & " - " & Session(strName) & "<BR>"
Next
Anyways, if you create a page containing only the snip of code you've posted
above, will the error occur?

Yes, an ASP page with only the following:
<%
Dim Item
For Each Item in Session.Contents
Response.Write Item & " - " & Session(Item) & "<BR>"
Next
%>
produces the same error.

If I remove the .Contents then I get the following error:
Microsoft VBScript runtime error '800a01b6'
Object doesn't support this property or method
/trs/test.asp, line 3
Try:

Dim x
For Each x in Session.Contents
Response.Write x & " - " & Session(x) & "<BR>"
Next
%>

Just a theory, but Item is a keyword in VBScript. That might be the
cause of the error.

--
Mike Brind

Jul 21 '06 #8

P: n/a

Mike Brind wrote:
Jerry wrote:
Bob Barrows [MVP] wrote:
Jerry wrote:
I'm using this code:

Dim strName
For Each strName in Session.Contents
Response.Write strName & " - " & Session.Contents(strName) & "<BR>"
Next

If I only do a response.write strName, it shows all the session names
but when I include the session.contents it gives me the following
error:

Microsoft VBScript runtime error '800a01c2'

Wrong number of arguments or invalid property assignment

I've been to http://www.aspfaq.com/show.asp?id=2373 and it talks about
using ADODB.Recordset but I'm not accessing data on this page.

Any ideas why this is happening?

Thanks,
>
I've never used Session.Contents, but it should work. This is what I always
do:
>
For Each strName in Session
Response.Write strName & " - " & Session(strName) & "<BR>"
Next
>
>
Anyways, if you create a page containing only the snip of code you've posted
above, will the error occur?
Yes, an ASP page with only the following:
<%
Dim Item
For Each Item in Session.Contents
Response.Write Item & " - " & Session(Item) & "<BR>"
Next
%>
produces the same error.

If I remove the .Contents then I get the following error:
Microsoft VBScript runtime error '800a01b6'
Object doesn't support this property or method
/trs/test.asp, line 3

Try:

Dim x
For Each x in Session.Contents
Response.Write x & " - " & Session(x) & "<BR>"
Next
%>

Just a theory, but Item is a keyword in VBScript. That might be the
cause of the error.
Same error. I was initially using strName instead of Item but saw Item
in an example.

--
Jerry

Jul 21 '06 #9

P: n/a
Jerry wrote:
>>
Anyways, if you create a page containing only the snip of code
you've posted above, will the error occur?

Yes, an ASP page with only the following:
<%
Dim Item
For Each Item in Session.Contents
Response.Write Item & " - " & Session(Item) & "<BR>"
Next
%>
produces the same error.

If I remove the .Contents then I get the following error:
Microsoft VBScript runtime error '800a01b6'
Object doesn't support this property or method
/trs/test.asp, line 3
I was just able to reproduce your error by using:
for each key in session.Contents
Response.Write "<BR>" & key & ": " & session.contents(key)
next

The error went away when I changed it to:
for each key in session.Contents
Response.Write "<BR>" & key & ": " & session(key)
next

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 21 '06 #10

P: n/a

Bob Barrows [MVP] wrote:
Jerry wrote:
>
Anyways, if you create a page containing only the snip of code
you've posted above, will the error occur?
Yes, an ASP page with only the following:
<%
Dim Item
For Each Item in Session.Contents
Response.Write Item & " - " & Session(Item) & "<BR>"
Next
%>
produces the same error.

If I remove the .Contents then I get the following error:
Microsoft VBScript runtime error '800a01b6'
Object doesn't support this property or method
/trs/test.asp, line 3

I was just able to reproduce your error by using:
for each key in session.Contents
Response.Write "<BR>" & key & ": " & session.contents(key)
next

The error went away when I changed it to:
for each key in session.Contents
Response.Write "<BR>" & key & ": " & session(key)
next
Thanks Bob, I'll try that Monday morning and see how it works!

--
Jerry

Jul 22 '06 #11

P: n/a

Bob Barrows [MVP] wrote:
Jerry wrote:
>
Anyways, if you create a page containing only the snip of code
you've posted above, will the error occur?
Yes, an ASP page with only the following:
<%
Dim Item
For Each Item in Session.Contents
Response.Write Item & " - " & Session(Item) & "<BR>"
Next
%>
produces the same error.

If I remove the .Contents then I get the following error:
Microsoft VBScript runtime error '800a01b6'
Object doesn't support this property or method
/trs/test.asp, line 3

I was just able to reproduce your error by using:
for each key in session.Contents
Response.Write "<BR>" & key & ": " & session.contents(key)
next

The error went away when I changed it to:
for each key in session.Contents
Response.Write "<BR>" & key & ": " & session(key)
next
Sorry for the delayed response. This does not work either.

--
Jerry

Jul 25 '06 #12

This discussion thread is closed

Replies have been disabled for this discussion.