C# Authentication - setting UserRole as global variable? -


our dba has sproc authentication returns user role if successful validation occurs.

in custom authentication class, validateuser method hits sproc via entity model & domain service, , since sproc returns rolename on successful validation, have instance of it.

when comes time run getrolesforuser method in custom roleprovider, suppose write sproc grab rolename again, seems bit redundant, since i've retrieved role. i'd love able cache user role in validateuser method, access in getrolesforuser method, , ride off sunset. not save time writing sproc, limit number of db calls app making.

thoughts?

scott

thats correct. when running custom roleprovider, have session state can use store value of "rolename".. alternately, can extend membershipuser call include string field "rolename" can populate in first call , assign context.user.

i not suggest cache object here becuase roles tied user.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -