[SOLVED] Issue with Session Variables

Answered Closed
0
0

Hi

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?

Regards

Washington

Attachment
  • You must to post comments
Best Answer
0
0

Hi Washington,

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.

Best regards
Frank

  • You must to post comments
Showing 1 result