2

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.

ridermansb
  • 10,779
  • 24
  • 115
  • 226

2 Answers2

1

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

jgauffin
  • 99,844
  • 45
  • 235
  • 372
  • `Application_PostAuthenticate(object sender, EventArgs e)` or `Application_AuthenticateRequest(object sender, EventArgs e)` what's the difference?? – ridermansb Sep 30 '11 at 14:56
  • PostAuthenticate is invoked *after* the membershipprovider has authenticated the request. It's therefore the proper place to add your custom identity – jgauffin Sep 30 '11 at 16:47
  • @jgauffin - Could you please share sample code or link? I have a same problem but I couldn't solve it. – Sasan Nov 25 '18 at 05:01
-1

Just create a wrapper and override Page.User.

James Johnson
  • 45,496
  • 8
  • 73
  • 110