Custom IIdentity object casting

Custom IIdentity object casting

am 25.01.2008 18:23:21 von Random

I've seen this topic around a bit, but no solution offered to the problem.
I have a custom class that implements IIdentity with additional properties,
some of which are essential to the authorization process. On login, I can
create and set the user based on the login, but when a subsequent page
request is made, the User.Identity is back to the standard. Now, logic
dictates that I could simply cast that instance of Identity back into my
custom class, but it doesn't work.

To me, this seems buggy. I would think that when asp.net reloads the
Principal and the Identity, that they would do so with the same class type
that they were first created under, based on them having the interface, but
that doesn't work. Even if the node in web.config had
"principalType" and "identityType" attributes....

Can this be set somewhere? Or handled in a different way that doesn't rely
on going outside this process?