0

Is it possible to persist a class in session that I define in VBScript in classic asp:

<script runat=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.

Caveatrob
  • 12,667
  • 32
  • 107
  • 187

1 Answers1

1

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.

Community
  • 1
  • 1
Castrohenge
  • 8,525
  • 5
  • 39
  • 66