Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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:
HTML
<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
Updated 29-Jan-13 2:07am
v2
Comments
Sandeep Mewara 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?

BUT how can i reset it plz tell me?
 
Share this answer
 
Clear the session after your use.
C#
Session["yourcartsession"] = null;


Hope this helps.
 
Share this answer
 
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900