当我尝试使用未经身份验证的用户访问我的主页时,我收到一个空白页面。
如果我在 Global.asax.cs Appliaction_Error() 中调试代码,我会收到此错误There is no action defined with the specified name "ViewLayout" for permission set "Controls"
。
我试过了:
Guid everyOneRoleId = new Guid("86ae86b4-7617-4ab3-bc30-b98aaabf68cc");
Permission permission = pageManager.GetPermission(
SecurityConstants.Sets.LayoutElement.View,
pageManager.GetSecurityRoot(false).Id,
everyOneRoleId );
if (pa == null)
{
pa = pageManager.CreatePermission(
SecurityConstants.Sets.LayoutElement.View,
pageManager.GetSecurityRoot(false).Id,
everyOneRoleId );
pageManager.GetSecurityRoot(false).Permissions.Add(permission);
pageManager.SaveChanges();
}
但它没有奏效。
文档:
https ://docs.sitefinity.com/for-developers-crud-operations-with-permissions