访问项目时模拟其他用户
var user = Sitecore.Security.Accounts.User.FromName("sitecore/testname", false);
using (new Sitecore.Security.Accounts.UserSwitcher(user))
{
var item = Sitecore.Context.Database.GetItem("/sitecore/content/home");
}
var user = Sitecore.Security.Accounts.User.FromName("sitecore/testname", false);
using (new Sitecore.Security.Accounts.UserSwitcher(user))
{
var item = Sitecore.Context.Database.GetItem("/sitecore/content/home");
}