I'm not talking about asp.net membership.
For each logged user I want to cache some properties like status or the number of friend requests, from the db.
I can create custom class which would do it but I thought it will be better to extend the existing User.Identity property.
Something like this:
Label1.Text = User.Identity.Status;
It is possible?
It is possible by defining your own IIdentity
(and possibly IPrincipal
too) and constructing this when creating the IPrincipal
for the HTTP request. I believe the correct place to do this is when the PostAuthenticateRequest
event is raised.
The answers on this other stackoverflow question explain how to do it - ASP.NET set custom identity or principal (it says for MVC but both go through the same processing pipeline).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With