Classic asp persist custom classes in session
Is it possible to persist a class in session that I define in VBScript in classic asp:
<script runa开发者_运维百科t=server language=vbscript>
Class clsCourse
Private Sub Class_Initialize
' Statements go here.
End Sub
End Class
dim oCourse
set oCourse=new clsCourse
</script>
How would I persist oCourse in session and recover it from session?
I know session is bad, but this is a high volume application and I'm concerned about hitting the database multiple times in a page call.
EDIT: Take a look at these answers for a more thorough explanation Classic ASP Store objects in the session object
Unfortunately you can't store classes in session. This page gives a good explanation:
https://web.archive.org/web/20061026090950/http://www.4guysfromrolla.com/aspfaqs/ShowFAQ.asp?FAQID=195
One solution could be to make the class a wrapper for an array and just store that array in session.
精彩评论