Session in classic ASP

对着背影说爱祢 提交于 2019-12-07 01:33:29

问题


I'w working on a project in classic ASP and I want to add, for example, some users for a temporary list and when I submit the form, this data will be save to DB.

I know how to work with this in asp.net, but not in classic asp.

Is it possible to create lists of users, for example, and manage this in a session?

thanks!


回答1:


yesa, you can use this, or the application state. one thing do note, you cant save objects in it, so you'll need to do some serialization if you want to store any complex things in it.


Session("username")="Donald Duck"
Session("age")=50

http://www.w3schools.com/ASP/asp_sessions.asp




回答2:


OPINION

You do have a couple of options of which a session is not one I would recommend. Just using form posting would be preferable just because of all the potential overhead with sessions in general. The most you would generally want to use them for is login data storage for a user logged into a site.

Not classic asp but good to know in all future endeavors with Sessions http://www.aspnet101.com/2010/10/asp-net-session-state-best-practices/

Answer http://www.w3schools.com/ASP/asp_sessions.asp


  //adding values to a session CSV
  //Yes I know these are not vbscript comments 
  //but I cant use vb comments   
  Session("someString") = "Value1,Value2,Value3"

  //Retrieving a value from a session
  Dim valsArr = Split(Session("someString"),",")

  //returning all content in a session object
  dim i
  For Each i in Session.Contents
    Response.Write(i & " ")
  Next



来源:https://stackoverflow.com/questions/3996884/session-in-classic-asp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!