Can Session Variables be read by client-side JavaScript performing form validation, or are these variables only available to VBScript?
On a login asp page I create a session variable vPwd that is set to the login password.
On the asp page where the user can change their password I tried to accomplish the following in the client-side validation:
var curpwd = Session(“vPwd”)
if (theForm.CurrentPassword.value != curpwd)
{
alert(“You did not enter the password with which you loged in.”);
theForm.CurrentPassword.focus();
return (false);
}
When I ran the code, I received an error message regarding ‘object expected’ pointing to the line with the If.
To test, I changed
var curpwd = Session(“vPwd”)
to
var curpwd = “edc2839”
The error message stopped appearing.
Is there a way I can get JavaScript to read Session variables?