FAQ

Created by Webnodes

     

What skills are required to create websites in Webnodes?

Webnodes requires that you are familiar with C# and Asp.Net programming. You do not need to be an expert, but a general understanding of setting up a Asp.Net website in Visual Studio and understanding of the key principles in object oriented programming is needed. Knowledge of HTML, CSS and some javascript is also required. You do not need knowledge of SQL.

What do I need to install and develop with Webnodes?

You need Visual Studio 2007 or 2010. For the database you need Sql Server Express, Sql Server or MySql.

What are the hosting requirements of Webnodes?

Windows Server 2003 or 2008
1 GB memory. (2 Gb if the database is running on the same server.)
Dual Core CPU

How can I set up IIS to host Webnodes?

The recommended settings for an IIS website are:

  • Full access to the file system within the website root folder. This means giving the ASP.Net user and the App_Pool Process identity user (normally NetworkService) full access in the NTFS file system. On some systems the “Network Service” system user must be given full access to the .Net temp folder as well:
  • Run in full thrust mode, (only applicable to IIS7)
  • Pipeline mode: Integrated mode, (only applicable to IIS7):
  • Turn off App Pool recycling as much as possible:
  • Allow the IIS App Pool at least 400 mb of private memory limit before recycling. Be sure to check that your hosting partner meet this last requirement. Many shared hosting environments do not support this. Almost all dedicated server or virtual server hosting support it. See our website for recommended hosting partners.
  • To enable friendly URL’s you need to set up wildcard mapping to the .Net Runtime.

For more information on how to setup IIS please read Configuring IIS.

Typical errors you may encounter

  • Error: "CREATE DATABASE permission denied in database ‘master’. An attempt to attach an auto-named database file XXX.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share." 
    Possible solution: Change App pool identity from ApplicationPoolIdentity to some other such as LocalSystem.
  • Error: "Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed."
    Possible solution: Disable Asp.Net Impersonation under the Authentication section in IIS manager for your site. Please make sure disabling impersonation is a valid option for your scenario.

What are the key steps in creating a template?

  1. Create an .aspx with a C# codebehind file in Visual Studio. Base the file on a suitable masterpage if you are using the masterpage system in Asp.Net.
  2. Add web controls to the aspx file and write the necessary code in the codebehind file to populate the controls with data relevant to the pageview.
  3. Log into Webnodes and create a reference to the template file in the template module.
  4. Next, define which content classes can use the template.
  5. The template is ready to be used. Open a relevant content and in the option tab you should be able to select the template you just created.

How do I create a hierarchal navigation menu?

Most websites base their navigation on a hierarchal tree structure. In Webnodes you can base the navigation on any relation or query you can do from any content node, but a hierarchal structure is often used as the base of the top level navigation. The content module in Webnodes displays content in a tree structure based on the one-to-many relation “Native.RelHierarchal” which is represented by the “Parent” and “Children” property found on the “Native. HierarchalContent” base class. All content classes that inherit from this can be positioned in the tree structure found in the content module. The “Native.RelHierarchal” relation is consequently the widely used relation in tree menu structures.

There are of course many ways to render a tree based menu in HTML, but the logic and the recursive functions needed basically the same. Here is an example of a conventional tree menu where the selected item and branch are expanded and highlighted:

In the aspx file (or masterpage) we include a literal control to insert the HTML:

<div class="Menu">
  <asp:Literal ID="litMenu" runat="server" EnableViewState="false" />
</div>

In the c# code behind file we include this code to render the menu:

protected void Page_Load(object sender, EventArgs e) {
    litMenu.Text = getMenuHtml();
    litSiteTitle.Text = HttpUtility.HtmlEncode(WAFContext.Session.GetSite().Name);
}

string getMenuHtml() {    
    StringBuilder html = new StringBuilder();
    HierarchicalContent hc = WAFContext.Session.GetContent<HierarchicalContent>(WAFContext.Session.SiteId);
    buildMenu(hc, 1, html);
    return html.ToString();  
}     

void buildMenu(HierarchicalContent parent, int level, StringBuilder html) {
    foreach (HierarchicalContent child in parent.Children.Query().Where(AqlHierarchicalContent.ShowInMenu == true).Execute()) {
        bool onSelectedBranch = child.IsParentOrSame(WAFContext.Request.NodeId);  
        html.Append("<div class=\"MenuItem");
        html.Append(level);
        if (onSelectedBranch) {
           html.Append(" MenuItemSelected");   
        }
        html.Append("\"><a href=\"");
        html.Append(HttpUtility.HtmlAttributeEncode(WAFContext.GetUrl(child.NodeId)));
        html.Append("\">");
        html.Append(HttpUtility.HtmlEncode(child.Name));
        html.Append("</a></div>");   
        if (onSelectedBranch) {
           buildMenu(child, level + 1, html); 
        }
    }
}

The sample of the output is:

Root document  

       Example article 1

       Example article 2  

            Example article 3

            Example article 4  

            Example article 5

Can I host multiple sites in one installation?

Yes. You can have many Webnodes installations on one server. For each installation you need one license, but in each installation you can have several sites. Each site has its own set of contents and domains.

Sites in an installation share the same datamodel defined in the Semantics module, but everything else can be completely separated. Each site can have its own set of users, templates, domains etc. and a limited user logging into Webnodes would only see content and functionality relevant to his or her site.

For larger websites we recommend one installation per site unless the sites are sharing a lot of content. For portals etc. with many similar websites, one installation with multiple sites is a good solution as you as an administrator can manage through one interface.

How specific can I make the security settings?

In addition to all this. There are lots of other places you can restrict access like: Sites, Modules, File Libraries etc.

Access control in Webnodes is done by referring to user groups. The membership of these groups determine the users access. Every content object in Webnodes have three key access properties. The READ, the EDIT and PUBLISH access group. The users in the selected EDIT group can create new preliminary revisions, but cannot make direct changes that cause changes to live content. Only members of the selected PUBLISH group can do this.

In addition to this you can set the READ and WRITE access group on every property in the Semantics module. These properties can also be controlled in realtime and individually one each content as well by overriding access functions in the contents partial class file. (For example, let us say you wantet to restrict access to certain properties until certain other properties are set correctly.)

The membership of groups is primarily based on a relation property but it can also be based on a query and dynamic data. For instance this can be very useful if you want a usergroup for all users in the age range from 20-30 years of age. This would automatically make a user a member of this group as time goes by and his age is within the range.

What about caching, how does this work in Webnodes?

Webnodes has a built in ORM engine that is used for all content in the solution. The result is that absolutely all content is retrieved and updated through one API. (That includes, users, sites, documents, files, templates etc.)

Since everything is accessed through one API and runtime the built in cache in the ORM is very smart and efficient. Every query is cached and every change refreshes the minimum and relevant part of the cache instantly. The result of this is that most content queries in Webnodes are super-fast and up-to-date, even when content is changing continuously. As a consequence you do not need even consider the page cache system built into Asp.Net unless you are experiencing traffic in excess of 100 000 hits an hour. Webnodes is of course compatible with the Asp.net page cache system, but using it does complicate the template design as it does with any website with dynamic data.

How do I create a login page?

If a visitor is requesting a webpage in Webnodes where he or her is not a member of the READ user group, the system will redirect the request to the default Asp.Net Forms Autentication login page. This page is just a normal Asp.Net Forms Autentication loginpage and Webnodes membership provider is compatible with the built in login controls found in Asp.Net. This forms authentication login page is specified in the Web.Config file. The login page is also specified for each website in Webnodes in the site settings. This setting will override the setting in Web.Config. The login page is just a normal .aspx file with a asp.net login control.

How do I create a search page?

For search pages you will mostly want to query the built in Lucene index engine.

Here is example with paging and a content extract in the search result:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:TextBox runat="server" ID="txtSearch"></asp:TextBox>
            <asp:Button ID="btnSearch" OnClick="btnSearch_Click" runat="server" Text="Search" />
            <asp:Literal runat="server" ID="litResult" EnableViewState="false"></asp:Literal>
        </div>
    </form>
</body>
</html>

How do I customize the authorization of user?

In Webnodes you can override both the determination of a user identity and authentication.

The identity is by default aligned with the identity if the Asp.Net Identity user which by default is based on forms authentication. But sometimes you want to override this alignment. Typically you may want to use the users IP or some information in request header as basis for the identity. To do this you must create your own identity provider for Webnodes. See the documentation on the “WAFIdentityProvider” class.

The authentication mechanism is by default done by comparing the given password against the hashed password property of the SystemUser object. You can overload this method if you want to base this on other mechanisms, like looking up the user in a LDAP directory. Here is an example:

public override bool Autenticate(string password) {
    bool isValidAdUser = false;
    try {      
        using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, "ldap_path")) {   
            string userName = this.UserName;
            isValidAdUser = pc.ValidateCredentials(userName, password);
            WAFLog.Insert("Security", "Autentication", isValidAdUser.ToString());
        }
    } catch (Exception error) {
        WAFLog.Insert("Security", error);  
    }
    return isValidAdUser;
}

This code is put in the partial code of a content class that inherits from “Native.SystemUser”.

What's the best way to check if you are on the frontpage?

If you want to know if the current node is the start or default node (homepage/frontpage of the site) use the following code. This will safely get the id of the startnode. This way you avoid errors if you move the site, change the URL of the site or switch to another start page etc.

int startNodeId = WAFContext.Session.GetDefaultNodeId(WAFContext.Session.GetDefaultSiteId());
if (startNodeId == WAFContext.Session.CurrentNodeId) {
     //you are on the frontpage
}

How do I create a home link?

To create a home link you can simple write <a href="/">home</a> if your site is on the root of the domain. However this has a drawback. In the preview of the Webnodes edit interface this link will not retain state when navigating between pages in preview mode.   

The code below will make preview work better also when previewing your page for mobile.  

<a href="<%=(WAFContext.GetUrl(WAFContext.Session.GetDefaultNodeId(WAFContext.Session.GetDefaultSiteId())))%>">Home</a>