0 votes

Umbraco Utilities

Umbraco Utilities

Very useful library which consists of two main namespaces

  • Excetnsions
  • Configuration
Extensions namespace

This namespace contains extensions for IPublishedContent and IContent along with some useful extensions for HttpRequest and other .NET Framework classes to make work easier.

Configuration namespace

There is only one static class in this namespace named Config which enables reading quick config file. This file is stored in /Config/Website.config location.

This enables adding of some config values without touching Web.config and restarting app on IIS.
Fetching values from file is really easy and it is based on simplified XPath.
The following is example how to read sample config file in Razor template.

<?xml version="1.0"?>


  <projectname>Umbraco utilities</projectname>




    <device>Nokia X</device>

    <device>Sony Xperia</device>




The following is sample razor template which shows hot read above shown sample Website.config.

@inherits Umbraco.Web.Mvc.UmbracoTemplatePage

@using Umbraco.Utils.Configuration

@using Umbraco.Utils.Extensions


    Layout = null;


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">



  <meta http-equiv="content-type" content="text/html; charset=windows-1250">






          String value: @Config.GetValueAsString("/config/projectname")



          Integer value: @Config.GetValueAsString("/config/projectmajorver")



          Boolean value: @Config.GetValueAsString("/config/projectactive")



          List value:


              @foreach (string listValue in Config.GetValueAsStringList("/config/mobiledevices/device"))









Package owner

Dejan Stojanovic

Dejan Stojanovic

Dejan has 51 karma points

Package Compatibility

This package is compatible with the following versions as reported by community members who have downloaded this package:
Untested or doesn't work on Umbraco Cloud
Version 8.18.x (untested)

You must login before you can report on package compatibility.

Previously reported to work on versions:

Package Information

  • Package owner: Dejan Stojanovic
  • Created: 26/05/2014
  • Current version 1.0
  • License MIT
  • Downloads on Our: 783