|
-
Apr 7th, 2003, 10:15 AM
#1
Thread Starter
Fanatic Member
Session vars problem... please hlp
In page number one I have this:
<code>
<%
class hola
public a
end class
dim obj
set obj=new hola
obj.a="a"
set session("obj")=obj
%>
</code>
in page number two I have this
<code>
<% set obj=session("obj")%>
<%=obj.a%>
</code>
and In the page number two I get this error:
Microsoft VBScript runtime error '800a01b6'
Object doesn't support this property or method: 'a'
/p2.asp, line 10
My question is: what is the proper way to save objects in the session object? My objects are small so I dont think I will habe problems with the memory at server. Thank you very much!
"The difference between mad and genius is the success"
-
Apr 7th, 2003, 10:21 AM
#2
You dont. Objects in a sessino variable is bad, bad, bad, bad, bad, bad, bad, bad, bad!
you open an object with local scope to the page, use ithen close it out before the page is done loading.
NEVER, put an object into a session or application variable.
-
Apr 7th, 2003, 10:23 AM
#3
Thread Starter
Fanatic Member
Well I know its not the best... but with small objects it is not that bad.
Do you know the way to do this with the session object OR ANOTHER BETTER WAY?
Thank you
"The difference between mad and genius is the success"
-
Apr 7th, 2003, 10:34 AM
#4
Size doesnt matter. And I will not stop stressing it. You are only going to give yourself extreme memory leaks, and 0 scalability.
You have to learn that Web apps are NOT desktop apps, and there are many things you can't or should not do, such as persisting an object from page to page.
I am not being rude or anything, it is just I was handed down a project written like this with Session varaibles persisting an object, and had to reboot EVERY day because of the memory leaks it caused until I finished re-writing the application.
There is just no real reason for you to need to persist an object in a web application. If there are bits of info you need, you just persist that data as Session variables strings.
-
Apr 7th, 2003, 10:36 AM
#5
Thread Starter
Fanatic Member
It is bits of info that I need to storage...
Well If you think this is not a good idea... how can I do it then??
"The difference between mad and genius is the success"
-
Apr 7th, 2003, 11:20 AM
#6
You just persist the data you need into session varaibles. NOT the entire object. like say you need to save someone last name, Session("Lastname") = "Andersen"
that is ok.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|