I am having a problem using session variables in VB.net.
For example, the following line of code works.
Application.Session.UserCode = “Admin”
However, this doesn’t work.
x = Application.Session.UserCode
I have to enter
x = Application.Session(“UserCode”)
The equivalent code ‘x = Application.Session.UserCode;’ works in C#.
Am I doing something wrong?
in order to make x = Application.Session.UserCode work, you have to turn off Option Strict for your vb.net project.
(Section Compile in build options).
You can also turn it off as default for future vb.net projects in Tools / Options.
With Strict On you can only use the syntax x = Application.Session(“UserCode”).
Please note that the performance is the same as for the dynamix syntax.