Re: creating custom HttpContext.Current.User.Identity
From: Joe Kaplan \(MVP - ADSI\) (joseph.e.kaplan_at_removethis.accenture.com)
Date: 02/19/04
- Next message: Madan Nayak: "Re: Login/Logout Problem"
- Previous message: Yan-Hong Huang[MSFT]: "Re: Help for ActiveX"
- In reply to: dSchwartz: "creating custom HttpContext.Current.User.Identity"
- Next in thread: Josh: "Re: creating custom HttpContext.Current.User.Identity"
- Reply: Josh: "Re: creating custom HttpContext.Current.User.Identity"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Wed, 18 Feb 2004 23:18:32 -0600
I think you can use the same IPrincipal that Forms auth uses, but if for
some reason you can't, you can easily use the GenericPrincipal class with
your custom IIdentity implementation. Its constructor takes any type
implementing IIdentity.
It is also totally reasonable to derive from GenericPrincipal or
GenericIdentity (or most of the framework IIdentity or IPrincipal
implementations for that matter) if you want.
Joe K.
"dSchwartz" <schwartz@cableone.net> wrote in message
news:4ae1ece2.0402181442.70de4e41@posting.google.com...
> I've started getting into using forms authentication for asp.net apps
> with c#. From what i understand so far (limited) I like the way
> things work! I've got an application working right now where an email
> address and password is checked from a database and I can check the
> authenticated user's email address with
> HttpContext.Current.User.Identity.Name. This all works fine!
>
> I want to be able to do:
> HttpContext.Current.User.(customIdentity?).EmailAddress
> HttpContext.Current.User.(customIdentity?).UserID
> HttpContext.Current.User.(customIdentity?).NickName
>
> I'm just a bit confused about what i have to do after reading many
> different posts and articles about this. It seems to me like i should
> only have to create a custom class that extends IIdentity, but then to
> use that don't i have to create a custom class that extends IPrincipal
> also? and then it also seems i need a custom
> FormsAuthenticationTicket class also???
>
> I'm just looking for the simplest way to do this, which classes do i
> have to create custom for this action?
>
> Thanks for your time!
- Next message: Madan Nayak: "Re: Login/Logout Problem"
- Previous message: Yan-Hong Huang[MSFT]: "Re: Help for ActiveX"
- In reply to: dSchwartz: "creating custom HttpContext.Current.User.Identity"
- Next in thread: Josh: "Re: creating custom HttpContext.Current.User.Identity"
- Reply: Josh: "Re: creating custom HttpContext.Current.User.Identity"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|