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

A

adupuis

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
 
A

Alex Meleta

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
 
A

adupuis

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top