Extending IIdentity help

Discussion in 'ASP .Net Security' started by Spondishy, Jul 19, 2006.

  1. Spondishy

    Spondishy Guest

    Hi,

    I'm attempting to extend IIdentity to enable me to have more
    information on the user (email etc) and store it in a cookie. I assume
    I am extending the correct object (but if not shout up).

    Anyhow I've had a good stab at this, but I don't appear to get my
    extended identity back out of the cookie.

    At present I'm creating a FormsAuthenticationTicket by decrypting the
    cookie and then applying FormsIdentity(ticket) in an attempt to get the
    identity. I can't cast this back to my extended identity (only
    IIdentity).

    I know I'm going wrong. Has anyone a really good example of extending
    IIdentity, storing in cookies, retrieving the principal and sending to
    the webapp so it can use the user data.

    Help as always really appreciated.

    Thanks.
    Spondishy, Jul 19, 2006
    #1
    1. Advertising

  2. Hi,

    you have to re-create that IIdentity on every request -

    handle the AuthenticateRequest event (either in global.asax or a module)
    to do this. Afterwards it is available to page code.

    > Hi,
    >
    > I'm attempting to extend IIdentity to enable me to have more
    > information on the user (email etc) and store it in a cookie. I assume
    > I am extending the correct object (but if not shout up).
    >
    > Anyhow I've had a good stab at this, but I don't appear to get my
    > extended identity back out of the cookie.
    >
    > At present I'm creating a FormsAuthenticationTicket by decrypting the
    > cookie and then applying FormsIdentity(ticket) in an attempt to get
    > the identity. I can't cast this back to my extended identity (only
    > IIdentity).
    >
    > I know I'm going wrong. Has anyone a really good example of extending
    > IIdentity, storing in cookies, retrieving the principal and sending to
    > the webapp so it can use the user data.
    >
    > Help as always really appreciated.
    >
    > Thanks.
    >
    Dominick Baier, Jul 19, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tim Mulholland

    Custom IIdentity class - how to set it?

    Tim Mulholland, Feb 20, 2004, in forum: ASP .Net
    Replies:
    6
    Views:
    4,629
    Steven Cheng[MSFT]
    Feb 24, 2004
  2. Craig Buchanan

    IIdentity casting problem

    Craig Buchanan, Feb 24, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    979
    Craig Buchanan
    Feb 24, 2004
  3. Amar

    Stupid Question ? IIdentity

    Amar, Dec 7, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    341
    Paul Glavich [MVP ASP.NET]
    Dec 7, 2004
  4. Spam Catcher

    Custom IIdentity w/ FormsAuthentication

    Spam Catcher, Jan 6, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    6,335
    Spam Catcher
    Jan 7, 2006
  5. Spondishy

    Extending IIdentity help

    Spondishy, Jul 19, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    1,280
    Spondishy
    Jul 19, 2006
Loading...

Share This Page