经典ASP在会话中保留自定义类 [英] Classic asp persist custom classes in session
问题描述
是否可以在经典ASP中的VBScript中定义的会话中保留类:
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.
推荐答案
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:
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.
这篇关于经典ASP在会话中保留自定义类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!