Saturday, March 24, 2012

Session variables

Hello!

I'm very new with ASP.NET so my question may be...

I'mworking in a webshop and I'm trying to build a shopping cart. Ihave made the products page with a datalist and a Access DB. My problemis when passing the item I chose to buy to the cart. I'm trying to usea session variable but don't know how send (cart.aspx?id=xx) and toreceive it.

Could someone try to explain that to me? Some examples would help too. (working with .NET 1.1 and VB).

Thanks in advance.

Store your id in a Session variable..

Session("ID") = some_value..

In your cart.aspx you can use

id = Cint(Session("ID"))

Don't forget to check if Session("ID") is Not Nothing in cart.aspx, otherwise it throws exceptions.


You can also take a look at this article to learn more about ASP.NET state management:

http://msdn2.microsoft.com/en-us/library/z1hkazw7.aspx

0 comments:

Post a Comment