简体   繁体   中英

Session in classic ASP

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!

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM