Storing extended IIdentity in HttpContext.Current.User (IPrinciple)

Posted by UpTheCreek on Stack Overflow See other posts from Stack Overflow or by UpTheCreek
Published on 2010-05-14T08:08:47Z Indexed on 2010/05/14 8:14 UTC
Read the original article Hit count: 449

Filed under:
|

I have created an ExtendedId class which extends GenericIdentity. (This stores Id as well as name)

In a httpmodule I stored this extended id in Current.User like so:

HttpContext.Current.User = new GenericPrincipal(myExtendedId, roles);

Problem is, later, how do I get at my ExtendedId type again?

If I try this:

ExtendedId eId = (ExtendedId)HttpContext.Current.User.Identity;

I get a casting error. I have a feeling I'm doing something stupid here with casting, but I'm a bit foggy this morning.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about c#