Reputation: 2713
I have an .net web application where I am authenticating a user through another means as well as using a login form.
when the user logs in through the "other means" I want to be able to find the user in the membership DB using the MembershipProfider.Finduser() and if they exist (ie they passed the external auth means and also exist int he DB so they can login) If all this is tru, I want to then tell .net "this" is the current user.
How do I SET the current user?
Upvotes: 1
Views: 480
Reputation: 883
I assume you're using FormsAuthentication? Have a look at FormsAuthentication.RedirectFromLoginPage() and FormsAuthentication.SetAuthCookie().
Upvotes: 1
Reputation: 115749
I guess setting Thread.CurrentThread.CurrentPrincipal
will do the job. You might also want to create your own implementations of IPrincipal
and IIdentity
, although this is not strictly neccessary.
Upvotes: 1