Latest wiki updatehttp://our.umbraco.orgumbracoNew pages on the umbraco documentation wikienReading RSS Feeds, Aggregating and Sortinghttp://our.umbraco.org/wiki/how-tos/xslt-useful-tips-and-snippets/reading-rss-feeds,-aggregating-and-sortingFri, 12 Mar 2010 10:16:26 GMThttp://our.umbraco.org/wiki/how-tos/xslt-useful-tips-and-snippets/reading-rss-feeds,-aggregating-and-sortingHere's a quick summary of how to read multiple RSS feeds, merge them, sort them and then output the first 30 items. 

Preparation

  1. Set up a doc type named 'RssFeed' with a property called 'url' (textstring)
  2. Create RSS Feed nodes in the Content section with your chosen feed urls
  3. Create an XSLT macro with the code that follows.
  4. Add xmlns:msxsl="urn:schemas-microsoft-com:xslt" to namespace on the top of XSLT page.

XSLT

Just put this into an <xsl:template> and it will output the first 30 items.

<!-- Find all RSS Feed nodes, create new XML tree with all rss nodes merged into the 'container' node -->
<xsl:variable name="rssFeeds">
 <container>
   <xsl:for-each select="$currentPage/ancestor-or-self::root//node [@nodeTypeAlias='Feed Item']">
     <xsl:variable name="url" select="string(data[@alias='url'])" />
     <!-- Is the url populated? -->
     <xsl:if test="string-length($url) &gt; 0">
       <!-- Import the feed-->
       <xsl:copy-of select="umbraco.library:GetXmlDocumentByUrl( $url )"/>
     </xsl:if>
   </xsl:for-each>
 </container>
</xsl:variable>
<!-- Iterate through the container doc -->
<xsl:for-each select="msxsl:node-set($rssFeeds)/container/rss/channel/item">
 
 <!-- Sort the items -->
 <xsl:sort select="pubDate" order="descending"/>
 <!-- Only output the first 30 items -->
 <xsl:if test="position() &lt;= 30">
   <h1>
     <a>
       <xsl:attribute name="href">
         <xsl:value-of select="link/text()"/>
       </xsl:attribute>
       <xsl:value-of select="title/text()"/>
     </a>
   </h1>
   <p>
     <xsl:value-of select="description/text()" />
   </p>
 </xsl:if>
 
</xsl:for-each>

 

 

]]>
Run the scheduler at certain timeshttp://our.umbraco.org/wiki/how-tos/run-the-scheduler-at-certain-timesWed, 10 Mar 2010 22:16:35 GMThttp://our.umbraco.org/wiki/how-tos/run-the-scheduler-at-certain-times

Umbraco has a built in scheduler function. Here are some notes about how to use the scheduler for tasks at certain times.

In the file /config/umbracoSettings.config there's a commented setting that if active runs every x seconds:

<!-- add tasks that should be called with an interval (seconds) -->
<!--    <task log="true" alias="test60" interval="60" url="http://localhost/umbraco/test.aspx"/>-->

If you uncomment it and set a real url to your site Umbraco will open that address at the specified interval.

<task log="true" alias="test60" interval="60" url="http://www.mysite.com/runscheduler.aspx"/>

Note that log="true", if you have problems with the scheduler you should have a look in the umbracoLog table, it will have a row for every time. When the scheduler is running properly you can disable logging if you like to reduce clutter in the log.

Now if you add a page at the specified address with a template that contains a macro, the macro will run each minute. But how to control certain tasks to be executed at certain times? Say that you need some statistics to be sent each day at 8:00, or once a week or something like that.

Here is one example of an XSLT that will send an email at certain times ('Run once every hour at hh:00', 'Run once a day at 8:00' and 'Run each first 5 days of the week, at 8:00'):

<xsl:template match="/">
<xsl:variable name="sendFromAddress" select="'website@mycompany.com'"/>
<xsl:variable name="sendToAddress" select="'admin@mycompany.com'"/>

<!-- This sample is made for scheduling each 60 seconds -->
<xsl:variable name="minuteInHour" select="Exslt.ExsltDatesAndTimes:minuteinhour()"/>
<xsl:variable name="hourInDay" select="Exslt.ExsltDatesAndTimes:hourinday()"/>
<xsl:variable name="dayInWeek" select="Exslt.ExsltDatesAndTimes:dayinweek()"/>

<!-- Run once every hour at hh:00 -->
<xsl:if test="$minuteInHour=0">
<xsl:value-of select="umbraco.library:SendMail($sendFromAddress, $sendToAddress, 'Triggered by site schedule', 'Run once every hour at hh:00', false())"/>
</xsl:if>

<!-- Run once every day at 8:00 -->
<xsl:if test="$hourInDay=8 and $minuteInHour=0">
<xsl:value-of select="umbraco.library:SendMail($sendFromAddress, $sendToAddress, 'Triggered by site schedule', 'Run once a day at 8:00', false())"/>
</xsl:if>

<!-- Run once every day at 8:00 the first 5 days in the week (depends on "first day of the week" in global settings) -->
<xsl:if test="$dayInWeek&lt;6 and $hourInDay=8 and $minuteInHour=0">
<xsl:value-of select="umbraco.library:SendMail($sendFromAddress, $sendToAddress, 'Triggered by site schedule', 'Run each first 5 days of the week, at 8:00', false())"/>
</xsl:if>

</xsl:template>

If you dont like the scheduler to run as often as each minute you can increase the number of seconds in settings. But one has to have in mind that the scheduler does not start at 00:00, but rather whenever the the app pool starts. Therefore, if you run it each 10 minutes you will need to round the minute like this:

<xsl:variable name="minuteInHour" select="floor(Exslt.ExsltDatesAndTimes:minuteinhour() div 10)*10"/>
<!-- minuteInHour will be 0,10,20,30,40 or 50 -->

Also have in mind that if the app pool is not running, neither will the sceduler. So for the scheduler to run good you will need to make sure your site is active.

You could use a ping'er for that - yeah yet another schedule, but not from the same web server...

For the SendMail function to work you will need to set the Smtp settings in your Web.config.

]]>
Adding Css and JS using the ClientDependencyhttp://our.umbraco.org/wiki/reference/templates/adding-css-and-js-using-the-clientdependencyTue, 02 Mar 2010 20:34:56 GMThttp://our.umbraco.org/wiki/reference/templates/adding-css-and-js-using-the-clientdependencyAs of version 4.1, the ClientDependencyFramework has been added to Umbraco.

This ensures that only 1 copy of a file is included, even if you have an include in several templates. It is used in the backend to ensure a small footprint.

You can also use it in the front-end yourself. Here's an example how to use it:

 

<%@ Master Language="C#" MasterPageFile="~/umbraco/masterpages/default.master" AutoEventWireup="true" %>
<%@ Register Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" TagPrefix="CD" %>
<asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
<html>
<head runat="server">
	<title>Title</title>
	<CD:CssInclude ID="CssInclude1" runat="server" FilePath="~/Css/Styles.css" />
	<CD:CssInclude ID="CssInclude2" runat="server" FilePath="~/Css/AnotherStyle.css" />
	<CD:JsInclude ID="JsInclude1" runat="server" FilePath="~/Scripts/jquery-1.3.1.min.js" />
	<CD:JsInclude ID="JsInclude2" runat="server" FilePath="~/Scripts/scripts.js" />
</head>
<CD:ClientDependencyLoader runat="server" id="Loader" />
<body>
Your content here
</body>
</html>
</asp:Content>

 

]]>
How to implement your own 404 handlerhttp://our.umbraco.org/wiki/how-tos/how-to-implement-your-own-404-handlerSat, 27 Feb 2010 14:45:57 GMThttp://our.umbraco.org/wiki/how-tos/how-to-implement-your-own-404-handlerIn some scenarios the build in mechanism for the 404 handlers are not sufficient. But you can easily implement your own 404 handler. Just create a class which implements the umbraco.interfaces.INotFoundHandler interface. This interface defines two properties and one method. Let's assume you have several domains in your umbraco installation: www.domain1.com, www.domain2.com, www.domain3.com, etc. With the standard definitions in the /config/umbracoSettings.config you can only separate by language (en-US, de-DE, etc). In this case you would implement something like this:

using System.Web;
using umbraco.interfaces;

namespace MyLibrary.Handlers
{
public class MyNotFoundHandler: INotFoundHandler
{
private int redirectId;

public bool Execute(string url)
{
var server = HttpContext.Current.Request.ServerVariables["SERVER_NAME"].ToLower();
if (server == "www.mydomain1.com")
{
redirectId = 1234; // the id of the 404 and search page from domain1.com
return true;
}
if (server == "www.mydomain2.com")
{
redirectId = 5678; // the id of the 404 and search page from domain2.com
return true;
}
return false;
}

public bool CacheUrl
{
get { return false; }
}

public int redirectID
{
get { return redirectId; }
}
}
}

Explanation:

The method Execute is the entry point to this handler and gets the requested url. But you can also use the HTTPContext with all the ServerVariables of the HttpRequest.

If the handler finds a solution to redirect to another node you have to set the local redirectId variable which is read by the request handler if the Execute method returns true. If the Execute method returns false the two properties won't be read by the request handler and the next 404handler (if defined in the config) will be called.

You can also define if this url with it's redirected id will be cached or not.

Configuration:

Be sure to add the dll to the bin folder and update the /config/404handlers.config.

]]>
404handlers.confighttp://our.umbraco.org/wiki/reference/files-and-folders/files-in-the-config-folder/404handlersconfigSat, 27 Feb 2010 14:21:48 GMThttp://our.umbraco.org/wiki/reference/files-and-folders/files-in-the-config-folder/404handlersconfigThe /config/404handlers.config contains the definitions which handler will be used to handle not found requests in Umbraco. The file has by default the following content:

<?xml version="1.0" encoding="utf-8" ?>
<NotFoundHandlers>
<notFound assembly="umbraco" type="SearchForAlias" />
<notFound assembly="umbraco" type="SearchForTemplate"/>
<notFound assembly="umbraco" type="SearchForProfile"/>
<notFound assembly="umbraco" type="handle404"/>
</NotFoundHandlers>

You can easily add your own not found handler. Therefore you have to add a new entry like this:

<notFound assembly="ASSEMBLYNAME" namespace="YOURNAMESPACE" type="HANDLERCLASS" />

Attributes:

Assembly: The assembly property defines the name of the dll without the file extensions.

Type: The name of the class which implements the INotFoundHandler interface.

Namespace: Is the Namespace other than the assembly name you have to add the namespace under which the handler class is defined. Is the namespace the same as the assembly name you can leave out this attribute.

Entry Example:

Let's say you have a class named "MyNotFoundHandler" with is defined in the namespace "MyLibrary.Handlers" but the complete project is only named "MyLibrary" and so it is compiled to MyLibrary.dll. Then you have to add the following entry:

<notFound assembly="MyLibrary" namespace="MyLibrary.Handlers" type="MyNotFoundHandler" />

Entries Order:

It's important to know that the order in which the entries are placed in the file also defines the order in which the handlers are executed. So if you want to be sure that your handler will be the first handler insert it as the first entry.

References:

How to implement your own 404 handler

]]>
Working in Visual Studio when developing umbraco solutions (2nd Way)http://our.umbraco.org/wiki/codegarden-2009/open-space-minutes/working-in-visual-studio-when-developing-umbraco-solutions/working-in-visual-studio-when-developing-umbraco-solutions-(2nd-way)Sat, 27 Feb 2010 13:01:21 GMThttp://our.umbraco.org/wiki/codegarden-2009/open-space-minutes/working-in-visual-studio-when-developing-umbraco-solutions/working-in-visual-studio-when-developing-umbraco-solutions-(2nd-way)Hi,

I understand the very first approach has been discussed in Open Space Session. I haven't attended but still wish to add my way of using Umbraco with Visual Studio 2008. By this approach, I get everything in one sweet place and I can easily debug my application by Debug->Attach to process option.

I won't be talking about multi-developer environment and steps as that are provided in our first approach.

Steps

1. Unzip Latest Umbraco package and point IIS website to that folder (It is still advisable to user IIS Admin pro for XP users). Follow the installation step and make it up and running.

2. I would suggest installing Runway or web-site package by Warren Buckley.

3. Create a Web-Application using Visual Studio 2008 or later version. By default you will get folder and files given by Web-Application say web.config and bin folder. Now close your web-application / project in VS2008

4. Now go to your Umbraco website root folder, select all files and folders and copy / paste it to the root folder of your Visual Studio 2008 web-application. Process will ask do you want to overwrite. Click yes / all

5. Once you copy all the files and folder of your Umbraco web-site to VS2008 web-application root directory. Go to IIS and now point your website folder to the new location that we have, ie your VS2008 web-project root directory.

6. While Umbraco installation as per instructions, we have to give NETWORK SERVICE rights to the website, we need to do the same here. Add NETWORK SERVICE rights to the VS2008 web-application root folder. Later make sure your website is running fine, do check by logging-in admin mode as well.

7. Finally open the Web-Application project in VS2008, and in "Solution Explorer", locate second icon that says "Show All files". On click, all the files that exist in web-application project and not included will be shown to you.

8. Include the following list of folders to Web-Application project, 

·         App_Browsers

·         app_code

·         bin

·         config

·         css

·         data

·         masterpages

·         media

·         scripts

·         Umbraco

·         umbraco_client

·         usercontrols

·         xslt.

Note: (Umbraco and umbraco_client folders might take longer time while you include)

In the Umbraco, default.aspx is not linked with default.aspx.cs and designer files. (You can link it, if required. your call!).

Note: Worth mentioning, when you include data folder in VS2008, it might have some folders that are named by GUIDs. I would suggest you to exclude those folders. I have experienced ambiguity compilation errors on user controls. But after excluding those GUID named folders from my project, it successfully compiled.

Oh yes, do not forget to reference cms, businesslogic and umbraco assemblies to VS web-application.

For working in team, copy the installed version to all development machines and have a centralized database(Probably this is a good practice rather going for db on each dev machine).

And then you are good to go with your development ;) 

I have successfully added this project in SVN-subversion and TFS and able to maintain without any issues.

Release build for same project was given further by using Publish feature from VS2008.

All good!! 

Umbraco remains my favorite CMS ;)

 

Cheers,

Ranjit J. Vaity

To all Umbraco geeks, If you have any suggestion, advice or better approach please write back.

]]>
Checkbox to activate a button macro with jqueryhttp://our.umbraco.org/wiki/reference/code-snippets/checkbox-to-activate-a-button-macro-with-jqueryWed, 24 Feb 2010 16:04:00 GMThttp://our.umbraco.org/wiki/reference/code-snippets/checkbox-to-activate-a-button-macro-with-jqueryhad a client ask me to develop something for them this morning and thought i would share....

client wanted a little checkbox on a page confirming they agree, then activate a button to take you to an off site appliction... no data storage or anything going on on the umbraco side... i just needed a deactivated button, a checkbox to activate it and a macro to really let the client take care of this because they were not entirely clear on the forwaring url, etc.

so, here is what i did....

first, made sure i had jquery on the page...

then, wrote this little function...

<script type="text/javascript">
/* <![CDATA[ */
    function toggleStatus() {
            if ($('#toggleElement').is(':checked')) {
            $('#elementsToOperateOn :input').removeAttr('disabled');
        $('#elementsToOperateOn :input').addClass('pretty-button');
        } else {
        $('#elementsToOperateOn :input').attr('disabled', true);
        $('#elementsToOperateOn :input').removeClass('pretty-button');
        }
}
/* ]]> */
</script>

made sure i set the form/button to inactive on my document.ready code...

<script type="text/javascript">
/* <![CDATA[ */
$(document).ready(function(){

$('#elementsToOperateOn :input').attr('disabled', true);

});
/* ]]> */
</script>

then, i created a simple xslt macro -- allowed it to be inserted into the wysiwyg editor and viola! here is my xslt...

<xsl:template match="/">
<xsl:variable name="confirmText" select="/macro/checkBoxText"/>
<xsl:variable name="buttonText" select="/macro/submitText"/>
<xsl:variable name="landingPage" select="/macro/landingPage"/>

<!-- start writing XSLT -->
<form action="{$landingPage}" method="post">
<p>
    <input id="toggleElement" type="checkbox" name="toggle" onClick="toggleStatus()" />&nbsp;<xsl:value-of select="$confirmText" disable-output-escaping="yes"/>
</p>

<div id="elementsToOperateOn">
<input type="submit" value="{$buttonText}" id="surveyButton"/>
</div>
</form>
</xsl:template>

Hope someone finds this useful for a project need up the line somewhere :)

]]>
Code Snippetshttp://our.umbraco.org/wiki/reference/code-snippetsWed, 24 Feb 2010 16:00:33 GMThttp://our.umbraco.org/wiki/reference/code-snippetsThis section of the wiki can be used to store various code snippets... could be xslt goodies, good be little jquery or javascript snippets that jut might make everone's coding experience a bit more fun!

]]>
Getting Started with Umbraco: Whats Next After You Installhttp://our.umbraco.org/wiki/how-tos/getting-started-with-umbraco-whats-next-after-you-installThu, 18 Feb 2010 18:19:38 GMThttp://our.umbraco.org/wiki/how-tos/getting-started-with-umbraco-whats-next-after-you-installSo you’ve finished your first installation of Umbraco, perhaps to your local PC to try it out. Now you're wondering, “What Next?"

This guide will help you get started with setting up a website in Umbraco. This document is based on my experience with learning and using the free version of Umbraco 4.0.3. 

 

What is Umbraco?

5-minute Video Introduction: http://umbraco.org/documentation/videos/getting-started/what-is-umbraco


Installation

There are plenty of documents about installing Umbraco, so I won’t cover the details here.

If you are trying out Umbraco for the first time, you may want to install it to your local PC. 

To find more documents on installing Umbraco, see the home page of this wiki. There are also PDFs about installation on the Umbraco download page itself http://umbraco.codeplex.com/releases/

As of this writing, I haven't seen one install guide that contains everthing I would want in such a document. I recommend you look at several to get all the information you can.

You may find my own install notes helpful - see the last section in this document.

Setting up an Umbraco Web Site 

The Admin Page

After you have successfully installed Umbraco, you will probably be looking at the default admin page. (I don’t know the official name for this page, so I will call it the “admin page.”)

If you are not on the admin page, point your browser to http://<YourSite>/umbraco/umbraco.aspx. On my local installation, I use http://localhost:81/umbraco/umbraco.aspx (I set up Umbraco to use port 81). If you are not logged in, this URL will first redirect you to the login page.  

The Umbraco admin page has three main panes: Content (top left), Sections (bottom left), and the main panel (large panel on the right).

The Content panel on a default empty install will show a only Content folder with the Recycle Bin folder under it. 

The Runway Demo Site

If you did not choose install Runway as part of your Umbraco install, I recommend you install it when learning Umbraco. Runway is a bare bones demo website that will show you an example of how to set things up using best practices. 

If you want an even more fleshed out site, you can install the Creative Website Starter (CWS) at  http://our.umbraco.org/projects/creative-website-starter-(cws). The CWS package contains a detailed document on how to install and set up CWS. 

To install Runway, go here: Umbraco admin page > Sections panel > Developer > Packages > Install Runway link > Install Runway button > click Yes > check Accept License > Install Package button. Do not close the page until the install is complete.

The Install Runway link under the projects folder appears to be hard-coded into Umbraco, so it’s always available to install if you want.

It is also easy to uninstall Runway if you ever want to: 

To uninstall Runway: Admin page > Sections panel > Developer > Packages > Installed Packages > Runway link > Uninstall Package button > Confirm Uninstall button.

 

Basic Concepts

The core concepts about an Umbraco website are Document Types, Templates, and macros.

Document Types

Before you can create a web page in Umbraco, you must first create a Document Type. Then when you do create the web page, you will specify which Document Type it is based on.

The Document Type defines the data that a web page will use. It also defines the interface you will see when creating the web page. A Document Type specifies which kind of data, fields (web controls), and content can go on the web page. Document Type does not have anything to do with web page presentation or layout - that is handled in Templates, which are described in a different section below.

To go to your Document Types:

Go to Umbraco admin page > Sections panel > Settings > Document Types folder > expand the folder. If you installed Runway, you will see two document types already created, Runway Homepage and Runway Textpage.

To create a Document Type:

  1. Go to Umbraco admin page > Sections panel > Settings.
  2. Right-click on the Document Types folder and enter a name such as “test.”

To set up a Document Type:

Access the Document Type by clicking on it in the Settings panel (go to admin page > Sections panel > Settings). In the main panel (on the right in your browser) you will see the tabs where you define that type.

  • Info tab sets such things as the Document Type name and which templates it can use.
  • Structure tab sets which child Document Types can be created under this one.
  • Generic Properties tab is where you specify what kind of content can go on web pages that are based on this Document Type. These Properties determine which fields and controls can appear on your web page. If you do not set any Properties, web pages using this Document Type will be blank. For example, if you want even just simple text on a web page, you must first add a new Property for it. To do this, in the Type drop down list on the Property page, set either Textbox Multiple (multi-line textbox) or Rich Text Box. 
  • Tabs tab is where you specify the tabs that will show up when you create a web page based on this Document Type. After you create a tab, you can assign Properties to it in the Properties tab.

To learn more, watch the free video about Document Types: http://umbraco.tv/documentation/videos/for-site-builders/foundation/document-types

Web Pages

As described above, web pages in Umbraco are based on Document Types. Before you can create a web page, you must have a Document Type for the type of page you want. 

To see to your web pages: Admin page > Sections panel > Content. Web pages will appear as nodes in the Content panel. 

To create a web page:

  1. If you do not yet have any web pages, create one by right-clicking on Content and choosing Create.
  2. Enter a name for the page and click Create. The page will show up under the Content folder (refresh your browser page if you need to).
  3. Click on your new page. In the right panel, you will see the tabs that allow you to set the content that will appear on the page.
  4. Enter the content for the page, by entering content in the tabs in the main panel. If you want your page to contain more types of content than are allowed here, you must edit the Document Template which is used by the page. To see which Document Type the page uses, go to the Properties tab for the web page.
  5. When you’re done, click the “save and publish” button in the tool bar.
  6. To see how your page looks in Umbraco, go to the Properties tab for that page, then click the "Link to Document" URL at the bottom of the tab.

Templates

Templates define the layout and presentation of a web page. Templates are where you define the design and layout, which CSS to use for the page, etc. 

When you create a Document Type, by default a Template is also created for that Document Type. 

Templates are actually .NET Master Pages. If you don’t know how Master Pages are used in a .NET website, you should learn about them. See http://www.asp.net/(S(sf10gzjodvrpce55el2p5cnk))/learn/master-pages/ 

Templates can be based on other templates.

To go to your Templates: Admin page > Sections panel > Settings > Templates folder.

To learn more, watch the free video about Templates: http://umbraco.tv/documentation/videos/for-site-builders/foundation/templates

Macros

Macros are used to get data from Umbraco and display it. For example, site maps, navigation, and news lists. This can be done using XSLT. Umbraco includes several pre-built XSLT macros, and you can also create your own.

Macros can also be used to wrap .NET user controls or custom controls, to include those in your web page.

For more information see the video http://umbraco.org/documentation/videos/for-site-builders/foundation/what-are-macros

 

More Info

 

How -To Videos

There are free videos at http://umbraco.tv/

To get started watch the following videos, which are part of the free "Foundation" series:

 

  • Document Types: http://umbraco.tv/documentation/videos/for-site-builders/foundation/document-types
  • Templates: http://umbraco.tv/documentation/videos/for-site-builders/foundation/templates

 

Outside the Foundation series, it appears most of the other Umbraco TV videos are not free. But a one-month subscription is very reasonable (about US $25). You will pay using PayPal.

 

Umbraco Forum

I have found the forum very helpful. I usually get a response within an hour or two.

http://our.umbraco.org/forum

 

Other Useful Guides

A Complete Newbie's Guide To Umbraco 

http://our.umbraco.org/wiki/how-tos/a-complete-newbie's-guide-to-umbraco

 

Wikipedia article for Umbraco

http://en.wikipedia.org/wiki/Umbraco

 

Notes about my first installation

My first local install

I did my first ever Umbraco install as a local installation on Windows Vista PC. I installed using the Microsoft Web App Gallery, http://www.microsoft.com/web/gallery/Umbraco%20CMS.aspx

The install process completed successfully, but Umbraco did not work until I went through the following document, http://umbraco.codeplex.com/releases/view/33743#DownloadId=95707

I went through the steps in this document, skipped steps I thought I could, and got it working. My main problem seemed to be setting the correct permissions on the Umbraco folders.

My first real website install, on a shared-hosted site

My company has several small shared-hosted websites. I am installing Umbraco to use for one of them.

I found the following document helpful: http://our.umbraco.org/wiki/install-and-setup/installing-umbraco-4-on-reliablesitenet-(or-similar-hosts)

I FTP'ed the Umbraco install archive (Umbraco 4.0.3) to my site's root directory. The Umbraco install files are found at http://umbraco.codeplex.com/releases/

I had to ask my hosting company to unzip the file for me.

I ran the Umbraco install by going to <mysiteURL>/default.aspx. I got to page 2 of the install, where you enter in your database connection information. Upon submit I got an error that Umbraco could not write to my web.config. So I asked my hosting company to fix the permissions.

Then I got through the rest of the install pages. However, at the very end I got the following ASP.NET error:

Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.

My host told me to fix this by doing the following, which worked:

 

Intermittent ASP.NET sessions: The cause of this intermittency is the recycling of the application pool where your site lives.

The best way of handling this issue is configuring your application to use "Out of Process" sessions, which is very easily accomplished by configuring the web.config in the following way:

<configuration>
   <system.web>
      <sessionState mode="StateServer" cookieless="false" timeout="20" stateConnectionString="tcpip=127.0.0.1:42424" />
   </system.web>
</configuration>

 

 

]]>
Difference between a Node and a Documenthttp://our.umbraco.org/wiki/reference/api-cheatsheet/difference-between-a-node-and-a-documentThu, 11 Feb 2010 09:02:49 GMThttp://our.umbraco.org/wiki/reference/api-cheatsheet/difference-between-a-node-and-a-documentFor a long time I didn't know what the difference was between a Node and a Document.

You can both fetch them using an id and they both have the GetProperties method.

Document document = new Document(id); 

umbraco.cms.businesslogic.property.Property documentProperty = document.getProperty("propertyName");

Node node = new Node(id);

umbraco.presentation.nodeFactory.Property nodeProperty = node.GetProperty("propertyName");

The real difference between these examples is the data which is being fetched. When you fetch a property using a Document you get the data which is stored inside the database, but when you fetch a property using a Node you only get the data which is published (and stored inside the umbraco.config file). 

For this reason you should use a Document if you’re programming in the backend and you should use a Node if you’re programming in the frontend.

Backend:

Document document = 
new Document(Convert.ToInt32(HttpContext.Current.Request.QueryString["id"]));

Frontend:

Node node = 
Node.GetCurrent();

 

 

]]>