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 September 14th, 2009, 12:04 AM
Authorized User
 
Join Date: Sep 2009
Posts: 24
Thanks: 3
Thanked 0 Times in 0 Posts
Default Session Variable in webshop

Hi,
I am using the shopping cart property
Code:
Public Shared ReadOnly Property ShoppingCart() As ShoppingCart
        Get

            If HttpContext.Current.Session("ShoppingCart") Is Nothing Then
                HttpContext.Current.Session("ShoppingCart") = New ShoppingCart()
            End If
            Return CType(HttpContext.Current.Session("ShoppingCart"), ShoppingCart)
        End Get
  End Property
as in c#
Code:
public static ShoppingCart ShoppingCart
        {
            get
            {

                if ((HttpContext.Current.Session[" ShoppingCart"] == null))
                   
               {
                    HttpContext.Current.Session["ShoppingCart"] =  ShoppingCart;
               }

                return (ShoppingCart)HttpContext.Current.Session["ShoppingCart"];
            }
        }
but it is giving error:
An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll
I think i am calling session variable which is not declared. can you suggest,
where this is declared in webshop project

Last edited by ashwinirajp; September 14th, 2009 at 12:17 AM.. Reason: code tag
 
Old September 14th, 2009, 02:20 AM
Authorized User
 
Join Date: Sep 2009
Posts: 24
Thanks: 3
Thanked 0 Times in 0 Posts
Default sort out

Thanx problem is sorted out,





Similar Threads
Thread Thread Starter Forum Replies Last Post
session and variable... badboy1 ASP.NET 3.5 Basics 1 August 3rd, 2008 09:14 AM
Session Variable youyou_hym Dreamweaver (all versions) 4 January 20th, 2005 11:48 AM
Session variable anuradha80 General .NET 3 November 4th, 2004 12:39 AM
Session variable mrideout BOOK: Beginning ASP.NET 1.0 1 August 12th, 2004 07:01 PM





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