SaaS CMS has officially launched! Learn more now.

Log in as user, programatically - CMS 12


In CMS 11 we could log in as a user like this

PrincipalInfo.CurrentPrincipal = new GenericPrincipal(new GenericIdentity("Dummy User"), new[] { "Everyone" });

It made sense in scheduled jobs, if it were important that the job had the privilieges as a normal visitor. Even if the job were started manually.

How can this be done in CMS 12? PrincipalInfo.CurrentPrincipal is readonly now.

Edited, May 29, 2022 9:55

Have you tried `IPrincipalAccessor`?

Jun 02, 2022 7:09

You are correct, Vincent, IPrincipalAccessor was the way to go! I figured it out, but forgot to update this thread.

Jun 02, 2022 7:12
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.