views:

40

answers:

2

Hi!

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  A: 

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

jasper
@ jasper 1+ Bump for great justice for it is correct.
Terrance
+1  A: 
Terrance
Can you show me some options?
AndreMiranda
I need to add a user and show him in a grid via ajax on the same page. But, I'm avoiding doing this by saving directly to database when "add user" button is clicked.
AndreMiranda
Have you considered using a cookie for the temp storage or using ajax in conjunction with JSON or XML? I wouldn't write to a db unless it is assured by the user that they are going to be added with the given info.
Terrance
I need to save this temporarily in somewhere, but I don't know where... that's why I thought in Session. In XML I would have to google how can I create a xml in asp, retrieve it and so on...
AndreMiranda
You could use a cookie and encrypt the data if security is a concern.(plus classic asp doesn't naively have a way for you to do this.) Or store the plain text data server side in a different format other that xml, like CSV.(XML is just a standardized way of storage in this case) But I would recommend JSON(Javascript Object Notation) just because it is supported anywhere javascript is supported and conceptually just a really big javascript array.
Terrance
But I'm digressing a bit for simplicity's sake I would just go with something similar to writing to a CSV file on the server and retrieving it for the ajax call and submit the form for the final db write.
Terrance
But how can I save temporarily for a JSON? Where this JSON would be stored?
AndreMiranda
You would store the json in a .js file on your server. Not all that different from the way you would any other number of files.
Terrance
a simple example of what json looks like http://www.json.org/js.html, Info about why JSON or CSV or XML http://stackoverflow.com/questions/138929/what-are-the-merits-of-csv-and-or-json-and-or-xml-and-or-output-in-a-rest-api
Terrance
and a tutorial on using json. Can I get some upvotes please? lol
Terrance
I worked a lot with json in asp.net, but never in classic asp. And I didn't know that you could save something in json form in run time!!
AndreMiranda
yep and here is that tutorial i meant to give http://www.developer.com/lang/jscript/article.php/3596836/Speeding-Up-AJAX-with-JSON.htm Okay so now can I get some upvotes please????? lol CANIHAZUPVOTES?????
Terrance
Okay then how about.... sudo CANIHAZUPVOTES -NOW -PLZ -KTHXBYE
Terrance