Site Content Type

From Sense/Net Wiki
Jump to: navigation, search
  •  
  •  
  •  
  •  
  • 100%
  • 6.0
  • Enterprise
  • Community
  • Planned

Overview

Sites are the primary placeholder for web pages and Content. The Site Content Type is the corresponding type to IIS sites. To define a site you have to set its urls and a start page, from then onwards it can be used as the top-level container of pages and Content.

Details

Sites and IIS sites

You can set up multiple Sites in the same portal. The defined Sites have to be set up in correspondence with the web site defined in IIS. For example, you can set up a single IIS site for www.example1.com and www.example2.com, then in Sense/Net you can either set up a single Site to handle both addresses, or set up two Sites: one for the first and another for the second address. In the former case the same page will be shown for both addresses, whereas in the latter case two different pages (and with different content under them) will show up for the two addresses. Setting up sites is done by creating Site Content under /Root/Sites and setting the Url list Field of the created Site. Also, it is desirable to set up a start page for the Site.

Url list

To define which url's should a Site handle, the Url list Field should be edited. This list contains the handled url's by the Site, and also the Site authentication information for every url. Authentication mode can be Windows (for Windows in IIS) or Forms (for Anonymous in IIS), for example:

Url list settings of a Site
Url Auth
www.example1.com Forms
www.example2.com Windows

In the above example the same Site handles 2 different urls, with 2 different authentication modes. As shown here, it is possible to set up a single site for different authentications: see details in the #Authentication section.

The Sites Url list settings can also be configured from the web.config. This can come handy if the administrator accidentally "locks himself out" by changing authentication mode and not being able to log in afterwards for various reasons. The url settings in web.config are commented out by default. Once uncommented and properly set, the web.config settings override the settings defined on Site Content. The following is an example of url list settings in web.config:

    <urlList>
      <sites>
        <site path="/Root/Sites/Default_Site">
          <urls>
            <url host="localhost" auth="Forms" />
          </urls>
        </site>
      </sites>
    </urlList>

If the url settings are defined in the web.config the following message appears at the Site Content edit views, showing that changes will not come to effect until the web.config contains url list definition:

Url list warning

Authentication

The authentication modes defined with the url list Field should be in correspondence with the IIS site's authentication settings. The following table summarizes how to set up sites with different authentication modes both in Sense/Net and in IIS:


Content identifying Fields
Authentication / log-in mode Sense/Net Site Url list settings IIS configuration
Forms www.example.com, Forms www.example.com; Anonymous allowed, all other denied
NTLM www.example.com, Windows www.example.com; Windows allowed, all other denied
Both for the same site forms.example.com, Forms; ntlm.example.com, Windows; forms.example.com, ntlm.example.com; Windows and Forms allowed, all other denied

It is also possible to use Forms authentication while authenticating users against an Active Directory upon logging in. Read the following article to know more: Forms authentication from AD.

Start page

If you don't provide any start page, the browse view of the Site will be shown when the Site is requested via url. The default start page can be created by creating a browse Application for the site. This can be done by creating the following structure under the Site:

  • Root
    • Sites
      • MySite (Site)
        • (apps) (SystemFolder)
          • This (Folder)
            • Browse (PortletPage)

The created Browse Application will serve as the default start page for the Site. It is also possible to set up an arbitrary page as start page - this can be done by creating a PortletPage anywhere under the Site and then referencing it in the Alternative start page Field of the Site.

Cross-site access

Since any Content in the Content Repository can be addressed with absolute urls, any Site's Content can be accessed via other sites. For example if we have two Sites set up in Sense/Net the following way:

  • /Root/Sites/MySite1, url: www.example1.com,
  • /Root/Sites/MySite2, url: www.example2.com,

then an arbitrary Content under MySite1 can be accessed with the following urls:

  • www.example1.com/MyContent
  • www.example2.com/Root/Sites/MySite1/MyContent.

Accessing Content of MySite1 via MySite2 can be undesired in cases when MySite1 is more restrictive (for example a secure site) than MySite2. To restrict Content access exclusively to the container Site use the Deny cross-site access switch on the Site:

Deny cross-site access

If it is set to true, the Content under the Site can only be accessed using the urls defined for the Site. For attempts to access the Content via another Site's url, the access is denied and a 404 not found status is sent back to the client. This feature can be switched off globally in the web.config to enable access to every Content regardless of their location and Site settings, in case the administrator accidentally "locked out" everyone from a Site:

   <portalSettings>
      ...
      <!--Enable the 'Deny cross-site access' feature. If true, DenyCrossSiteAccess property of sites is in operation. 
If false, every site is accessible via other sites with absolute addresses. -->
      <add key="DenyCrossSiteAccessEnabled" value="true"/>
   </portalSettings>

Parent type

Content handler

  • SenseNet.Portal.Site

Example/Tutorials

There are no examples for this article.

Related links

References

There are no external references for this article.