Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6
This is the forum to discuss the Wrox book ASP.NET 2.0 Instant Results by Imar Spaanjaars, Paul Wilton, Shawn Livermore; ISBN: 9780471749516
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 26th, 2010, 10:14 AM
Registered User
 
Join Date: Oct 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Shoppingcart code - what am I doing wrong?

Hi there, I still use and love this book, and I'm hoping someone can help - I have built and used the shoppingcart code and it works perfectly - however when I create the code within a web application project (VS2010), I get an error of "Unable to cast object of type 'SHOPPINGCART' to type 'fasc.SHOPPINGCART.":

Code:
HttpContext.Current.Session("Shoppingcart") = New SHOPPINGCART()
End If
Return CType(HttpContext.Current.Session("ShoppingCart"), SHOPPINGCART)
End Get
End Property
What am I missing? I'm converting a website I used the code in to the web application project model, but I'm stuck at this bit. Very frustrating!
 
Old May 26th, 2010, 11:10 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Sounds like the class SHOPPINGCART (is it really in all caps?) is defined twice. Try debugging your code and use the Watch window to find out the fully qualified type name for New SHOPPINGCART() and for HttpContext.Current.Session("ShoppingCart")

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
what is wrong in this code cancertropica ADO.NET 4 December 21st, 2008 04:08 AM
what's wrong with this code? hertendreef Visual Basic 2005 Basics 0 March 2nd, 2007 10:29 AM
What is wrong in this code? gajee ASP.NET 1.0 and 1.1 Basics 2 July 14th, 2006 06:41 AM
What is wrong with code? rtr1900 Classic ASP Databases 1 April 3rd, 2006 03:20 AM
What is wrong with this code? SaharaWizard VB Databases Basics 2 January 28th, 2006 08:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.