Session Variables are auto re-defining types.

I have a problem where, our App is using Session Variable control the current context Product.

No problems when the SessionVariable is AlpaNumeric.
No problems when the SessionVariable value becomes Numeric.

However, if User previously working on ProductCode='1234', then selects productCode='ABCD'. Then error occurs.

The SessionVariable is being re-defined between Pages.

eg.
No problems here :
Set @Session_ProductCode = 'ABC';
Set @Session_ProductCode = '123';
Set @Session_ProductCode = 'XYZ';

however, if i have
Set @Session_ProductCode = 'ABC';
Set @Session_ProductCode = '123';

Set @Result_NavigateUrl = '../Pages/home.aspx';

Then, when you come back to this page.
Then Error appears, cannot cast 'ABC' as INT.
(when it sees all numbers it redefines the type. in between pages.)

NOTE:
I have work around,
I set the SessionVariable with prefix 'X',
then each time i want to use this Variable in another Page, i remove the Prefix 'X'.

Just FYI,
1 person has
this problem
+1
Reply