newbie needs help with storing stateful information

R

Raymond Du

Hi,

I am working on a shopping cart application, I would like to know the best
methods to keep track of items users put into shopping cart. As far as I
know, here are some possible solutions: session, cookie, database table,
plain text file on server side.

Please consider the possibility of web farm environment, I was told session
does not even work in this situation because you could be on one server at
one time and others at other time.

TIA
 
E

EMW

For my application I use a dataset to store things within the procedures and
if I need to share it to other pages or to store it permenantly I write it
to disk with DataSet.WriteXML(filename, how to store it)

When I need it again, I user DataSet.ReadXML(filename, how it was stored)

It's maybe not the best method but it works for me.
The great thing about this is, that you can easily read the file to check
for errors during the programming.

rg,
Eric
 
R

Raymond Du

Thank you for the response. How do you make other pages aware of the file
name you use, did you pass it to other pages via querystring ,session,
cookie,....? Or did I misunderstand your response?

Thanks Again
 
S

Stefano Mostarda

Hi Raymond,

Session work correctly in a web farm too. With ASP.NET you can store
session variables in a sqlserver DB or in a machine accessible by all
others in the web farm. What's more everithing is transparent, you
access the session variables always in the same way.
i.e.
string myvar = Session["NAME"].ToString();
Session["NAME"] = "Stefano";

The only thing you have to configure is the sessionState element of the
web.config file in you application. Keep in mind that storing session in
an external store slow down aplication performance due to additional
step in the process of acquiring Session.

HTH,
Stefano Mostarda MCP
Rome Italy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top