on-internet
← Community

Scoping issue in mvc view causing IList to fail

Stack Overflow ·

I have a Session var that has a List such that: Session["roles"] = UserManager.GetRoles(uid) as List<string>; That totally works. But now I want to use it in my layout such that: @{ List<string> rolz = Session["roles"] as List<string>; }@ And unfortunately I keep getting this err: using the generic type "system.collections.generic.list<T>" requires 1 type arguments I see examples of passing lists over, but how do I use a preexisting session var that is already a list? Update 1 Please note: I'm interested in retrieving the Session["roles"] IN THE VIEW, not in another controller. As such the vie

Comments

Sign in or sign up to comment and upvote.

No comments yet.