Search code examples
asp.netasp.net-mvc-3authenticationiidentity

Custom User.Identity to add property


I customize RoleProvider and MembershipProvider classes

I would like to add one more property in my @User.Identity, as do so?

example:

@User.Identity.About => .About not exist yet

I thought I'd customize IIdentity but do not know where to start.


Solution

  • You need to create your own classes that implement IIdentity and IPrincipal. Then assign them in your global.asax in OnPostAuthenticate.