newbie needs help with storing stateful information

Discussion in 'ASP .Net' started by Raymond Du, Jul 3, 2004.

  1. Raymond Du

    Raymond Du Guest

    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
     
    Raymond Du, Jul 3, 2004
    #1
    1. Advertisements

  2. Raymond Du

    EMW Guest

    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
     
    EMW, Jul 3, 2004
    #2
    1. Advertisements

  3. Raymond Du

    Raymond Du Guest

    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
     
    Raymond Du, Jul 3, 2004
    #3
  4. 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
     
    Stefano Mostarda, Jul 3, 2004
    #4
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.