HELP: My ASP class object is crippled if I save it in a session collection

Ask a Question related to ASP, Design and Development.

  1. #1

    Default HELP: My ASP class object is crippled if I save it in a session collection

    I am using ASP3.0 and IIS5

    I want to have OOP so I have define a class call Employee with
    property 'fullName' and methods like getFullName().

    To save a group of employee in session, I use a dictionary.

    -----------------
    dim employees
    set employees = CreateObject("Scripting.Dictionary")

    dim vpOfSales
    set vpOfSales = new Employee
    vpOfSales.fullName = "Brian Miller"

    response.write vpOfSales.getFullName() ' work here
    employees.add "vpOfSales", vpOfSales

    Set session("employees") = employees
    ....
    -----------------

    The problem came when I retrieve the Employee objects in *another*
    page
    -----------------
    dim employees
    Set employees = session("employees")
    for each person in employees
    response.write person.getFullName() ' have error here
    next
    ....
    -----------------
    ASP complain the object doesn't have a property or method
    getFullName().
    What is the problem?
    Is there a solution?
    Philip Chan Guest

  2. Similar Questions and Discussions

    1. Commons Collection Class Not Found Error
      I've just started playing with Style Sheets . <mx:Style source="amethyst.css"/> Contents of the style sheet: Label { border-bottom-style:solid;...
    2. Loading of Class Object passed via PHP Session fails!
      Hello! I try to use PHP session function, and it doesn't work properly. :-( I want to pass a whole object from site A to site B to minimize...
    3. Collection class bound to DataGrid doesn't use my custom enumerator!
      Hello, I'm trying to implement a PageableCollection class so I can easily add custom paging functionality to my apps without the overhead of...
    4. I need to save a class object in a Session variable. Good? Bad?
      Hi, I am in a situation where I am forced into passing a class object around between a bunch of pages. The only way that I can figure out how to...
    5. getting name of class and/or parent class that object belongs to
      ed <coo_t2-NO-LIKE-SPAM@yahoo.com> wrote: : : Hey all. I'd like to convert some PHP code to Perl, but I'm not sure : how to do it in Perl. :...
  3. #2

    Default Re: My ASP class object is crippled if I save it in a session collection

    hI, iiLL SAVE YOU SOME HAIR PULLING.
    I did the same thing, same result.
    Turns out this is by design - You can't do that! You can't use classes in
    asp, and have them work across pages, such as with session variables

    There are articles about it out there, but it comes down to the fact that
    since the class can't be guaranteed to be the same across pages, it isn't a
    proper class.


    "Philip Chan" <philip.chan@uctv.ca> wrote in message
    news:2d7a757a.0309051248.aedfc4b@posting.google.co m...
    > I am using ASP3.0 and IIS5
    >
    > I want to have OOP so I have define a class call Employee with
    > property 'fullName' and methods like getFullName().
    >
    > To save a group of employee in session, I use a dictionary.
    >
    > -----------------
    > dim employees
    > set employees = CreateObject("Scripting.Dictionary")
    >
    > dim vpOfSales
    > set vpOfSales = new Employee
    > vpOfSales.fullName = "Brian Miller"
    >
    > response.write vpOfSales.getFullName() ' work here
    > employees.add "vpOfSales", vpOfSales
    >
    > Set session("employees") = employees
    > ...
    > -----------------
    >
    > The problem came when I retrieve the Employee objects in *another*
    > page
    > -----------------
    > dim employees
    > Set employees = session("employees")
    > for each person in employees
    > response.write person.getFullName() ' have error here
    > next
    > ...
    > -----------------
    > ASP complain the object doesn't have a property or method
    > getFullName().
    > What is the problem?
    > Is there a solution?

    Bite My Bubbles Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139