Secured section for partners

  Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic! Mail us feedback on this topic!  

Kentico CMS allows you to create secured site sections that can be accessed only by users who have a valid user name and password. We will create a simple page for partners that can be accessed only by registered users.

 

Go to CMS Desk -> Content, click root and click New. Choose to create a new Page (menu item). Enter page name Partners and choose to use the page template Templates with editable regions -> Simple text. Click Save. Click the Down arrow in the main toolbar until you move the Partners page at the end of the list.

 

Click the Page tab and enter the following text: This is a secured page for partners.

 

Click Save.

 

Click Propeties -> Security. In the Access section of the dialog, click Yes in the Requires authentication field and click OK. This will ensure that the page can be accessed only by authenticated users.

 

Configuring the logon page

 

Now we need to create the logon page. We will use a pre-defined page template that you can further customize if necessary. Click root and click New. Choose to create a new Page (menu item). Enter page name Logon and choose the page template Membership and security -> Log-on page with registration form. Click Save.

 

Click Properties -> Menu and uncheck boxes Show in navigation and Show in sitemap. Click Save and use the Down button to move the Logon page  to the end of the document list in the content tree.

 

tutorial_clip0136

 

We will also need to configure the system so that it uses our new logon page. Go to Site Manager -> Settings, choose My website in the drop-down list, click Security and set the value Website logon page URL to ~/logon.aspx, which is the relative URL of our logon page (from the web application root). Click Save.

 

tutorial_clip0137

 

 

Configuring the Sign out button

 

Go to CMS Desk -> Content -> select the root document -> click Design, add the following web parts to the zoneMain web part zone and set their properties:

 

Membership -> Current user

Content before: <div style="text-align:right">

 

Membership -> Sign out button

Content after: </div>

 

Then sort the web parts in the zoneMain zone in the following order (you can drag and drop web parts using mouse):

Current user
Sign out button
Page placeholder

 

tutorial_clip0138

 

Sign out of CMS Desk. Click Partners in the main menu. You are redirected to the logon page:

 

tutorial_clip0139

 

Now you need either to sign in as administrator or register as a new user. After you sign in successfully, you will see the Partners page content together with Sign out button:

 

tutorial_clip0140

 

You have learned how to secure part of the website so that it's only accessible for registered users.

 

 

 

Displaying personalized content based on user's permissions

 

Kentico CMS also allows you to display a personalized content based on user's read permissions. You can e.g. grant the Read permission for the Gold partners section to gold partners and then only the gold partners will see the menu item and page content.

 

You can find more details on personalized content in Developer's Guide -> Security, permissions and personalization -> Displaying personalized content.

 

You have just finished the sample website.

 

Page url: http://devnet.kentico.com/docs/5_5r2/tutorial/index.html?secured_section_for_partners.htm