 |
This topic applies only to Sitefinity versions prior to 3.2. From Sitefinity 3.2, the property "Anonymous
Access" is inheritable and there is no need of manual setting for child pages. |
If there is a preference to set the default value of the property "Anonymous Access" to "deny", there are at least two approaches to
use. This may be useful when creating new roles and thus avoiding the manual role assignment and configuration of each user so that access is forbidden
by default.
First Approach
The first approach is to create a custom http module and add a check on post authenticate to see if the user is authenticated. If not, the user could be redirected to another
page, for example.
Second Approach
Another approach is to add a method that executes at the Executing event of the Telerik.Cms.CmsManager class. If a new page is
created, set its DenyAnonymous property. Here is a sample class that shows how this could be implemented:
| DenyAnonymous Class |
Copy Code |
|
using System; using Telerik.Framework;
using Telerik.Cms; using Telerik.Cms.Data;
namespace Services
{
class DenyAnonymous : IService
{
public void Initialize()
{
CmsManager.Executing += new EventHandler<Telerik.ExecutingEventArgs>(CmsManager_Executing);
}
void CmsManager_Executing(object sender, Telerik.ExecutingEventArgs e)
{
if (e.CommandName == "CreatePage")
{
((CmsPage)e.CommandArguments).DenyAnonymous = true;
}
}
}
}
|
Also, the DenyAnonymous class should be added as a service in the web.config file:
| web.config |
Copy Code |
|
<telerik>
... <framework>
...
<services>
<add type="Telerik.Search.SearchModule, Telerik.Search"/>
<add type="Telerik.Search.Engine.IndexingManager, Telerik.Search"/>
<add type="Telerik.Rss.RssModule, Telerik.Rss"/>
<add type="Telerik.Rss.RssProviderService, Telerik.Rss"/>
<add type="Class1" />
</services>
...
</framework>
</telerik>
|
See Also