Session Variables

tehon3299

Well-known member
Joined
Jan 6, 2003
Messages
155
Location
Liverpool, NY
Can you reference session variables the same in C# as in VB? It seems to not like when I say:

string user = Session("userName");

It says something about: CS0118: System.Web.UI.UserControl.Session denotes a property where a method was expected

and points to that line. Any ideas?
 
C# uses square brackets instead of parentheses for accessing Indexers and Arrays:

C#:
string user = Session["userName"];
 
Back
Top