|
-
Apr 26th, 2006, 03:33 AM
#1
Thread Starter
Addicted Member
Session Objects
When I used to develop with classic ASP, I developed a number of applications that store shopping cart type information, in the begining I used to store the data in a session object, but found that if you tried to hold too many items in the session object it would have become unstable with unpredictable results, so I then used a temp database table and store the details with the session id which was normally their user id, this worked well but you had to keep clearing out the table, once the user had left.
Is this still the best way, or is there a better way in ASP.Net?
Thanks
-
Apr 26th, 2006, 03:39 AM
#2
Re: Session Objects
ASP.NET it's solid man.
Now it depends on the type of shopping cart that you want.
If you want to delete the customer's selections, then store them on sessions, use a DataTable for example.
If you want to keep it on a db, for the return of the customer, store it on the db and retrieve it later.
I say it again, it's solid man. You no longer have to worry about that stuff. That's history.
Now it's what fits you the most.
HTH
HoraShadow
Last edited by HoraShadow; Apr 26th, 2006 at 03:49 AM.
I do like the reward system. If you find that my post was useful, rate it.
-
Apr 26th, 2006, 03:49 AM
#3
Thread Starter
Addicted Member
Re: Session Objects
Ta,
I was wondering about creating a datatable, but then I got to thinking thats fine in VB.Net, but with ASP.net being stateless, how can you keep the table in session, when you go from page to page??
-
Apr 26th, 2006, 03:56 AM
#4
Re: Session Objects
Sessions are mantained by the browser and the port they are connected to. This is transparent to us.
As long as the user uses the same browser window, and the session on the server doesn't expire, he has his information stored in sessions.
Keep in mind that sessions are ByRef. So when you refer it to a variable to work with, all the modifications you do to the variable are reflected inmediatly on the session value.
You should play like 10-15 minutes with sessions so you see how they work.
HTH
HoraShadow
I do like the reward system. If you find that my post was useful, rate it.
-
Apr 26th, 2006, 04:04 AM
#5
Re: Session Objects
In the global.asax file there is an event for Session_End. Toast the DB data here.
Woof
-
Apr 26th, 2006, 04:08 AM
#6
Thread Starter
Addicted Member
Re: Session Objects
I understand about sessions and data, it is the datatable concept that is throwing me.
-
Apr 26th, 2006, 05:04 AM
#7
Thread Starter
Addicted Member
Re: Session Objects
Yep Session_End sounds best, I think.
there used to be a script for
WhileStillConnected, but will use the Session_End.
thanks
-
Apr 26th, 2006, 05:13 AM
#8
Re: Session Objects
 Originally Posted by soluga
Yep Session_End sounds best, I think.
there used to be a script for
WhileStillConnected, but will use the Session_End.
thanks
WhileStillConnected Script?
WOka
-
Apr 26th, 2006, 05:55 AM
#9
Thread Starter
Addicted Member
Re: Session Objects
yeah, will dig it out and post back. it was used to test if the user was still connected to the session object
-
Apr 26th, 2006, 06:09 AM
#10
Re: Session Objects
If you have far too many session variables and users, you can also look into storing session variables in SQL Server.
-
Apr 26th, 2006, 06:48 AM
#11
Thread Starter
Addicted Member
-
Apr 26th, 2006, 07:25 AM
#12
Re: Session Objects
yea...u can add a simple line to the web.config file that identifies the sql svr to use.
then all session vars are stored in there. this is a little slower than storing in memory, but releases resources on the web server.
woof
-
May 3rd, 2006, 06:54 AM
#13
Thread Starter
Addicted Member
Re: Session Objects
have been looking into this more and with V2.0 you can use the profile object!!
http://msdn.microsoft.com/library/de...erprofiles.asp
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|