我想访问 javascript 代码中的会话,以便设置和获取一些值:我尝试使用以下代码:
function getsessionvalue() {
var value= '<%= session["role"].ToString() %>';
alert(value);
//var role1= '<%= session["role"] %>'; **the same mistake**
//alert(role1);
}
Run Code Online (Sandbox Code Playgroud)
但我对两者都有这些 javascript 错误:
The type of the expression must be an array type but it resolved to
Type mismatch: cannot convert from String to int
Run Code Online (Sandbox Code Playgroud)