Can Linz, Austria
  • 11 years ago


  • 11 years ago

    Compilation Error

    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: CS0118: 'System.Web.UI.Page.Session' is a 'property' but is used like a 'method'

    Source Error:

    Line 25:         objDT.Columns.Add("Product", typeof(string));
    Line 26:         objDT.Columns.Add("Cost", typeof(Decimal));
    Line 27:         Session("Cart") = objDT;
    Line 28:     }
    Line 29:     

  • 11 years ago

    The syntax Session() is wrong, it must be Session[cart],

    We use () for methods, [] for arrays and indexers, Session is a Indexer.

    So the code must be


Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Some people, when confronted with a problem, think "I know, I’ll use regular expressions." Now they have two problems.” - Jamie Zawinski