hi
I'm trying to implement a custom forms authentication based on existing objects.
i have created the following classes classes:
[Serializable]
public class MyIdentity : IIdentity
{
// my custom members and properties
}
[Serializable]
public class MyPrincipal : IPrincipal
{
// my custom members and properties
}
i'm using the following code for my authentication:
identity = new MyIdentity("name");
principale = new MyPrincipal(identity, arrRoles);
HttpContext.Current.User = principale;
the problem is that after the page is redirected the following cast doesn't work
MyPrincipal user = (MyPrincipal)HttpContext.Current.User;
it throws a cast exception. what am i doing wrong here ?