1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / securing area of website

securing area of website

2 posts, 0 answered
  1. Meister
    Meister avatar
    262 posts
    Registered:
    09 Nov 2007
    01 Jan 2008
    Link to this post
    Hi

    I wish to create a secure area of a website

    The page is called support, and every subpage under this page must also be restricted

    this page, and all its subpages must appear in the menu, but when you try and access this section it will redirect you to a login/register page

    however, i dont want the users who register to be able to login to the admin part of the site

    is this possible?
    if so how would i do this?
    is there a video or article about this?

    thanks

  2. Yasen
    Yasen avatar
    121 posts
    Registered:
    18 May 2013
    02 Jan 2008
    Link to this post
    Hi Quade,

    The desired functionality is quite possible and easy to achieve with Sitefinity.

    You can set the Anonymous Access page property to deny. This way the page becomes inaccessible for anonymous users, as well as users that are not authorized to view it (don't belong to a role that has view rights for the page). You can do this for every page that goes under the "Support" page.

    Unfortunately, the default Telerik site map provider will hide these pages, due to the IsAccessibleToUser method, which is used to exclude from the site map pages, that are not accessible (are restricted). In order to achieve exactly what you need, you can override this method in a custom provider. To make sure it takes only a few minutes, here is the code for it:

    using System.Web;  
     
    public class CustomSitemapProvider : Telerik.Cms.Web.CmsSiteMapProvider  
    {  
        public override bool IsAccessibleToUser(HttpContext context, SiteMapNode node)  
        {  
            return true;  
        }  

    You can add it to the App_Code folder of your project and use it instead of the CmsSiteMapProvider. In order to do this, change the default site map provider in the web.config:

    <siteMap defaultProvider="CustomSiteMapProvider" enabled="true">  
      <providers> 
        <clear/> 
        <add name="CustomSiteMapProvider" description="Displays Cms Pages" type="CustomSitemapProvider"/>  
      </providers> 
    </siteMap> 

    After doing this, restricted pages will be shown in the site map, so that you can use the navigation controls as you please to show the site map.

    When an anonymous user tries to navigate to a restricted page, he will be redirected to the login page, defined in the authentication section of your web.config. You could create pages with login/registration functionality to enable users registration. You can find a working example in the demo TIU site. However, if an authenticated user tries to access a page that is restricted for him, it is up to you to provide a custom error page that will provide him/her with additional information.

    We are sorry, but for now there is no video available for this scenario. If you don't find the above information clear enough, feel free to contact us again.


    Regards,
    Yasen
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
2 posts, 0 answered