How can I login programmatically into Sitecore?

后端 未结 3 1954
闹比i
闹比i 2020-12-19 13:48

How can I login programmatically into Sitecore? For example if you would like to connect a small part of the Sitecore API to a desktop application, you would need to login i

3条回答
  •  忘掉有多难
    2020-12-19 14:18

    There is an easier way to accomplish your goal:

    1. Create a desktop application and reference the same version of the Sitecore binaries that your web app uses.
    2. Configure your desktop application to point to the same Sitecore DBs as your web site.
    3. Use the security disabler and then set the context as follows: Sitecore.Context.SetActiveSite("website");

    Sitecore may tell you that what you are trying to do will not work. But trust me, this works and I've used this method in a project before.

    Additional details: Sitecore uses the Master, Core and Web DBs as it's data store. My suggested method uses Sitecore APIs to write directly to the DBs. When using this method, you'll need to be aware of the cache implications.

    cheers!

提交回复
热议问题