473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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?
Jul 19 '05 #1
1 2088
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" <ph*********@uctv.ca> wrote in message
news:2d*************************@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?

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mike | last post by:
Hey guys I am pulling my hair out on this problem!!!!! Any help or ideas or comments on how to make this work I would be grateful! I have been working on this for the past 4 days and nothing I do...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
5
by: Arnold | last post by:
Hi, Im building a WebCustomControl. In my principal class (Inherits from WebControl), have a property of type MyCollection (Inherits from CollectionBase), which is a MyItem collection. To mantain...
7
by: Ben Amada | last post by:
I've created a class that I need to store in ViewState. However when I try to store it in ViewState, I get the following error: "The type 'solution.pe2' must be marked as Serializable or have a...
7
by: Shane Saunders | last post by:
I want to know how do i unlock a file from a Process. I have program that downloads 5 image files. I want to use this class for mutliple downloads of the same file name. The file are being add into...
8
by: Bruno Alexandre | last post by:
Hi guys, I'm using a session to save an ArrayList, so I do not read Database everytime user reload the page or enter the site (the Data is consistent for all entire session time when the user is...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
3
by: Trust Me; I'm from the government | last post by:
I have an employee class - in my page, when it loads, it gets all the employee data, including the employee Number. I have Dim emp As New Employee (at the top of the page, so it's global to the...
1
by: =?ISO-8859-1?Q?Lasse_V=E5gs=E6ther_Karlsen?= | last post by:
I get the above error in some of the ASP.NET web applications on a server, and I need some help figuring out how to deal with it. This is a rather long post, and I hope I have enough details that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.