Reputation: 4304
I have a vb.net aspx page that i need to assign a session variable inside of javascript
if i do the following
var baz ="<%=Session("User")%>";
alert(baz);
the alert i receive is the class name
"TheName.WebFramework.Security.AdvanceUser"
i need a nested value of this session , and have no idea how to do this in vb
i do however know how to do this in C# / generic http handler
...
public void ProcessRequest (HttpContext context) {
IAdvanceUser user = context.Session["User"] as IAdvanceUser;
...
var ID = user.EntityID
and of course in php, RoR , ColdFusion, ect
I have tried this but it failed miserably
var baz ="<%=Session("User").("EntityId")%>";
alert(baz);
any ideas?
Upvotes: 0
Views: 191
Reputation: 26386
Try this: use CType(fromObjectHere, toObjectHere)
var baz ="<%= CType(Session("User"), AdvanceUser).EntityID %>";
Update
You might need to type the full name TheName.WebFramework.Security.AdvanceUser
or import the namespace
<%= CType(Session("User"), TheName.WebFramework.Security.AdvanceUser).EntityID %>
Upvotes: 1