Invalid cast!

J

John Blair

Dim shoppingCart As Market.OrderList

Session("ShoppingCart") = New Market.OrderList

'This line produces an error - error details below.
shoppingCart = Ctype(Session("ShoppingCart"), Market.OrderList)

Can anyone tell me why the above cast doesn't work and how to fix it?
Note: Setting up the session variable succeeds.
thanks.

!!!!!Error Details!!!!!
Specified cast is not valid.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Specified cast is not valid.

Source Error:


Line 131:
Line 132: Dim shoppingCart As Market.OrderList
Line 133: shoppingCart = Ctype(Session("ShoppingCart"),
Market.OrderList)
 

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

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,266
Messages
2,571,081
Members
48,772
Latest member
Backspace Studios

Latest Threads

Top