Can

asp.net Linz, Austria
  • 13 years ago

     

  • 13 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:     

  • 13 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

    Session["cart"]=objdt;

Post a reply

Enter your message below

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

Contribute

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.

“There are 10 types of people in the world, those who can read binary, and those who can't.”