Unable to cast object of type 'System.Security.Principal.GenericIdentity' to type 'System.Web.Securi

Discussion in 'ASP .Net' started by adupuis@dublin.ie, Aug 31, 2007.

  1. Guest

    Hello, I'm currently working on a web application that normally works
    fine. Times to times I have the following error:
    '
    Unable to cast object of type
    'System.Security.Principal.GenericIdentity' to type
    'System.Web.Security.FormsIdentity'.
    '

    Have you an idea where it could come from ?
    I think it's linked to the line:

    Private formId As FormsIdentity = User.Identity

    My web.config has the line:
    <authentication mode="Forms"/>


    Regards
     
    , Aug 31, 2007
    #1
    1. Advertising

  2. Alex Meleta Guest

    Hi,

    Same interfaces does not mean parentness. System.Web.Security.FormsIdentity
    doesn't direved from System.Security.Principal.GenericIdentity.

    You can use only casting to common interface IIdentity in this case

    Regards, Alex
    [TechBlog] http://devkids.blogspot.com



    > FormsIdentity'
    >
     
    Alex Meleta, Aug 31, 2007
    #2
    1. Advertising

  3. Guest

    On Aug 31, 1:30 pm, Alex Meleta <> wrote:
    > Hi,
    >
    > Same interfaces does not mean parentness. System.Web.Security.FormsIdentity
    > doesn't direved from System.Security.Principal.GenericIdentity.
    >
    > You can use only casting to common interface IIdentity in this case
    >
    > Regards, Alex
    > [TechBlog]http://devkids.blogspot.com
    >
    > > FormsIdentity'


    The object should be of the System.Web.Security.FormsIdentity type,
    it appeared that I wasn't authenticated, simply.

    What I find weird is that the same problem occured to an user of the
    website
    on a page that was secured by the web.config:
    <authorization>
    <allow users="Jean, Jane, Mark"/>
    </authorization>


    Many thanks,
    Alex
     
    , Aug 31, 2007
    #3
    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.

Share This Page