Error Displyaing Session Variables

Discussion in 'ASP General' started by Jerry, Jul 21, 2006.

  1. Jerry

    Jerry Guest

    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
    Jerry, Jul 21, 2006
    #1
    1. Advertising

  2. Jerry

    Mike Brind Guest

    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
    Mike Brind, Jul 21, 2006
    #2
    1. Advertising

  3. Jerry

    Jerry Guest

    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
    Jerry, Jul 21, 2006
    #3
  4. "Jerry" <> wrote in message
    news:...
    >
    > 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?
    Anthony Jones, Jul 21, 2006
    #4
  5. Jerry

    Jerry Guest

    Anthony Jones wrote:
    > "Jerry" <> wrote in message
    > news:...
    > >
    > > 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
    Jerry, Jul 21, 2006
    #5
  6. 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"
    Bob Barrows [MVP], Jul 21, 2006
    #6
  7. Jerry

    Jerry Guest

    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
    Jerry, Jul 21, 2006
    #7
  8. Jerry

    Mike Brind Guest

    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
    Mike Brind, Jul 21, 2006
    #8
  9. Jerry

    Jerry Guest

    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
    Jerry, Jul 21, 2006
    #9
  10. 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"
    Bob Barrows [MVP], Jul 21, 2006
    #10
  11. Jerry

    Jerry Guest

    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
    Jerry, Jul 22, 2006
    #11
  12. Jerry

    Jerry Guest

    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
    Jerry, Jul 25, 2006
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Earl Teigrob

    Global Session Variables and Session State

    Earl Teigrob, Dec 16, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    4,258
    Alvin Bruney
    Dec 17, 2003
  2. =?iso-8859-15?Q?Fabr=EDcio_de_Novaes_Kucinskis?=

    Session Variables assigned to the wrong session?

    =?iso-8859-15?Q?Fabr=EDcio_de_Novaes_Kucinskis?=, Jan 20, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    702
    Alvin Bruney [MVP]
    Jan 20, 2005
  3. Robert Faulkner
    Replies:
    0
    Views:
    865
    Robert Faulkner
    Jan 28, 2005
  4. Replies:
    1
    Views:
    923
  5. Replies:
    9
    Views:
    922
Loading...

Share This Page