Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

online shopping

Status
Not open for further replies.

nnmmss72

Programmer
May 14, 2006
110
IR
i want to code a online shopping , when the user selected some items and add them to his/her basket and confirm the items and price , the price with some other information should be sent to bank site and the rest......

now my question is that what technlogy is the best to use for keeping the items that users has selected when he/she is srufing through the pages of my website, cookie? session? or what else?

can any one give a clue?

thanks
 
session is the best...

Known is handfull, Unknown is worldfull
 
id say a cookie, you can set the length of time, generate random unique identifiers and such, keep it clean and dont record personally identifiable things, promote safe cooking. Yeah some users block it, some will toss your cookies, but a 25 hour shopping cart is cool...
store the id and user ip with your cart database.

Code:
    public bool checkReturn()
    {
        HttpCookie cookie = Context.Request.Cookies["MyWebsite"];
        if (null == cookie)
        {
            return false;
        }
        else
        {
            return true;
        }
    }

    public string stoneCookie
    {
        get
        {
            HttpCookie cookie = Context.Request.Cookies["MyWebsite"];
            if (null == cookie)
            {
                return "0";
            }
            else
            {
                return cookie.Value;
            }
        }
        set
        {
            HttpCookie cookie = new HttpCookie("MyWebsite");
            cookie.Value = RandomCartIdentifier.Generate(20, 30);
            DateTime dtNow = DateTime.Now;
            TimeSpan tsMinute = new TimeSpan(0, 25, 0, 0);
            cookie.Expires = dtNow + tsMinute;
            Context.Response.Cookies.Add(cookie);
        }
    }
 
>>what is your reason?

the ENTIRE data is not saved in the client system (a reason why lots of guys dont like cookies)...


Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top