Context looses the ISitePrincipal...

G

Guest

Hello, I implemented a classic FormsAuthentication. I created my own classes that implement ISItePrincipal and ISiteIdentity. When the login is succesfull I do something like this:

newPrincipal = new CustomSitePrincipal(.....);
this.Context.User = newPrincipal;
FormsAuthetication.SetAuthCookie(...);
Response.Redirect("\Default.aspx");

In default.aspx all works fine, the Context.User.Identity.IsAuthenticated is true, but, the Context.User is no longer of CustomSitePrincipal type, instead it is a default FormssomethingPrincipal. Why does my context loose the SitePrincipal?? I need to persist it in this way so I can pull some information from it and display it on the page...

PS: I know this should work as I saw it work before, I just don't know what I am missing....

Any ideas?
Thank you,
Andrew.
 
J

Joe Fallon

In Global.asax add code for AcquireRequestState and then set your generic
principal to your custom principal.
--
Joe Fallon



Andrew Parks said:
Hello, I implemented a classic FormsAuthentication. I created my own
classes that implement ISItePrincipal and ISiteIdentity. When the login is
succesfull I do something like this:
newPrincipal = new CustomSitePrincipal(.....);
this.Context.User = newPrincipal;
FormsAuthetication.SetAuthCookie(...);
Response.Redirect("\Default.aspx");

In default.aspx all works fine, the Context.User.Identity.IsAuthenticated
is true, but, the Context.User is no longer of CustomSitePrincipal type,
instead it is a default FormssomethingPrincipal. Why does my context loose
the SitePrincipal?? I need to persist it in this way so I can pull some
information from it and display it on the page...
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top