Click here to Skip to main content
11,491,742 members (74,497 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
as i m trying to add product into the cart which i have done successfully but next time after run my project in visual studio that earlier product already there in the cart.but i want when new user visit the website and add the product into the cart that cart should be an empty. here is the code for to add value in the cart can any body plz tell me how i can pen:
    <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" />
    <input type="hidden" name="cmd" value="_cart" />
    <input type="hidden" name="add" value="1" />
    <input type="hidden" name="business" value="abhimanyu.vij@gmail.com" />
    <input type="hidden" name="item_name" value="pen" />
   
    <input type="hidden" name="amount" value="1.00" />
     <input type="hidden" name="currency_code" value="EUR" />
    <input type="hidden" name="shopping_url" value="http://localhost:50075/HTMLPage1.htm" />
    <input type="hidden" name="return" value="http://localhost:50075/HTMLPage1.htm" />
    <input type="hidden" name="cancel_return" value="http://localhost:50075/HTMLPage1.htm" />
    <input type="hidden" name="bn" value="PP-ShopCartBF:x-click-but22.gif:NonHosted" />
    <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but22.gif" name="submit"
        alt="Make payments with PayPal - it's fast, free and secure!" />
    <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1"
        height="1" />
    </form>
    pencil
    <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_cart" />
    <input type="hidden" name="add" value="2" />
    <input type="hidden" name="business" value="abhimanyu.vij@gmail.com" />
    <input type="hidden" name="item_name" value="Pencil" />
    <input type="hidden" name="amount" value="2.00" />
    <input type="hidden" name="shipping" value="1.00" />
     <input type="hidden" name="currency_code" value="EUR" />
    <input type="hidden" name="shopping_url" value="http://localhost:50075/HTMLPage1.htm" />
    <input type="hidden" name="return" value="http://localhost:50075/HTMLPage1.htm" />
    <input type="hidden" name="cancel_return" value="http://localhost:50075/HTMLPage1.htm" />
    <input type="hidden" name="bn" value="PP-ShopCartBF:x-click-but22.gif:NonHosted" />
    <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but22.gif" name="submit"
        alt="Make payments with PayPal - it's fast, free and secure!" />
    <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1"
        height="1" />
    </form>
    Car
    <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_cart" />
    <input type="hidden" name="add" value="3" />
    <input type="hidden" name="business" value="abhimanyu.vij@gmail.com" />
    <input type="hidden" name="item_name" value="Car" />
    <input type="hidden" name="amount" value="10.00" />
    <input type="hidden" name="shipping" value="1.00" />
     <input type="hidden" name="currency_code" value="EUR" />
    <input type="hidden" name="shopping_url" value="http://localhost:50075/HTMLPage1.htm" />
    <input type="hidden" name="return" value="http://localhost:50075/HTMLPage1.htm" />
    <input type="hidden" name="cancel_return" value="http://localhost:50075/HTMLPage1.htm" />
    <input type="hidden" name="bn" value="PP-ShopCartBF:x-click-but22.gif:NonHosted" />
    <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but22.gif" name="submit"
        alt="Make payments with PayPal - it's fast, free and secure!" />
    <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1"
        height="1" />
    </form>
    View Cart:
    <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="paypal">
    <input type="hidden" name="cmd" value="_cart" />
    <input type="hidden" name="display" value="1" />
    <input type="hidden" name="business" value="abhimanyu.vij@gmail.com" />
    <input type="hidden" name="shopping_url" value="http://localhost:50075/HTMLPage1.htm" />
    <input type="image" src="https://www.paypal.com/en_US/i/btn/view_cart_02.gif" name="submit"
        alt="Make payments with PayPal - it's fast, free and secure!" />
    </form>
Posted 29-Jan-13 2:29am
Edited 29-Jan-13 3:07am
v2
Comments
Sandeep Mewara at 29-Jan-13 8:09am
   
Shouldn't the cart session be reset for every user? How come a filled cart of one is visible to otheR?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

BUT how can i reset it plz tell me?
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Clear the session after your use.
Session["yourcartsession"] = null;

Hope this helps.
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 521
1 Maciej Los 336
2 Andy Lanng 273
3 Sascha Lefèvre 245
4 OriginalGriff 155
0 Sergey Alexandrovich Kryukov 9,829
1 OriginalGriff 8,530
2 Sascha Lefèvre 3,579
3 Maciej Los 3,332
4 Richard Deeming 2,370


Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 29 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100