A
aneesh
HI All,
I ma new to .NET. I was a java programmer for the past 2 years, and now
shifted to .NET. My company (A product based company) is rewritng an existing
portal produt from java to .NET, using c# and asp.NET. I ma into the
authntication module of this particular development.
I have developed some classes called TeNPrincipal wich impliments the
IPrincipal and TeNIdentity which impliments the IIdentity, when I have a
certain other properties for our portal user specific thing.
Now after successfull authentication in the login.aspx.as codebehind, i set
the formsauthcookie and create a new instance of the TeNprincipal and
Tenidentoty and add this TeNIdentity to the TeNPrincipal.
Now the next thing i do is do something like this:
Context.User = newTeNPrincipal(Context.User.Identity, TeNSecurity.GetRoles());
and redirects tothe desktop.aspx
Now on the
desktop.aspx when i try
TeNPrincipal principal = (TeNPrincipal) HttpContext.curent.User;
I get error invalid cast:
And whne i chek the type of HttpContext.curent.User it shows GenericPrincipal)
I also tried TeNPrincipal principal = (TeNPrincipal) Context.User;
None worked. what could be wrong. for the timebeing, I made a wrapper class
which returns and sets the TeNPrinicipla for the
user(TeNSecurity.SetPrincipal(...) && TeNsecurity.GetPrincipal() will return
the Ten principal where I am setting it something like this:
HttpContext.Current.Session.Add("TENPRINCIPAL",principal);
Now I want that Context.User = Tenprincipal to work.
What could be wrong?
Regards
Aneesh A.V
I ma new to .NET. I was a java programmer for the past 2 years, and now
shifted to .NET. My company (A product based company) is rewritng an existing
portal produt from java to .NET, using c# and asp.NET. I ma into the
authntication module of this particular development.
I have developed some classes called TeNPrincipal wich impliments the
IPrincipal and TeNIdentity which impliments the IIdentity, when I have a
certain other properties for our portal user specific thing.
Now after successfull authentication in the login.aspx.as codebehind, i set
the formsauthcookie and create a new instance of the TeNprincipal and
Tenidentoty and add this TeNIdentity to the TeNPrincipal.
Now the next thing i do is do something like this:
Context.User = newTeNPrincipal(Context.User.Identity, TeNSecurity.GetRoles());
and redirects tothe desktop.aspx
Now on the
desktop.aspx when i try
TeNPrincipal principal = (TeNPrincipal) HttpContext.curent.User;
I get error invalid cast:
And whne i chek the type of HttpContext.curent.User it shows GenericPrincipal)
I also tried TeNPrincipal principal = (TeNPrincipal) Context.User;
None worked. what could be wrong. for the timebeing, I made a wrapper class
which returns and sets the TeNPrinicipla for the
user(TeNSecurity.SetPrincipal(...) && TeNsecurity.GetPrincipal() will return
the Ten principal where I am setting it something like this:
HttpContext.Current.Session.Add("TENPRINCIPAL",principal);
Now I want that Context.User = Tenprincipal to work.
What could be wrong?
Regards
Aneesh A.V