Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Error Displyaing Session Variables

Reply
Thread Tools

Error Displyaing Session Variables

 
 
Jerry
Guest
Posts: n/a
 
      07-21-2006
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

 
Reply With Quote
 
 
 
 
Mike Brind
Guest
Posts: n/a
 
      07-21-2006

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

 
Reply With Quote
 
 
 
 
Jerry
Guest
Posts: n/a
 
      07-21-2006

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

 
Reply With Quote
 
Anthony Jones
Guest
Posts: n/a
 
      07-21-2006

"Jerry" <> wrote in message
news: 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?






 
Reply With Quote
 
Jerry
Guest
Posts: n/a
 
      07-21-2006

Anthony Jones wrote:
> "Jerry" <> wrote in message
> news: 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

 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      07-21-2006
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"


 
Reply With Quote
 
Jerry
Guest
Posts: n/a
 
      07-21-2006

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

 
Reply With Quote
 
Mike Brind
Guest
Posts: n/a
 
      07-21-2006

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

 
Reply With Quote
 
Jerry
Guest
Posts: n/a
 
      07-21-2006

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

 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      07-21-2006
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"


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Put variables into member variables or function variables? tjumail@gmail.com C++ 9 03-23-2008 04:03 PM
Session Variables and Static Variables cobus.lombard@gmail.com ASP .Net 1 03-26-2006 11:05 AM
RE: Session Variables assigned to the wrong session? Robert Faulkner ASP .Net 0 01-28-2005 04:16 PM
Session Variables assigned to the wrong session? =?iso-8859-15?Q?Fabr=EDcio_de_Novaes_Kucinskis?= ASP .Net 1 01-20-2005 04:33 PM
Global Session Variables and Session State Earl Teigrob ASP .Net 1 12-17-2003 07:02 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57