On-page editing and forms editing stop working in EPiServer 7

April 23rd, 2013

Working in EpiServer 7 we discovered that some pages, without any obvious reason, were suddenly not editable anymore.
Navigating in edit mode, the particular pages did not get the onpage edit borders and clicking the forms editing button would just make the ajax loader keep going forever. No errors in the logfile either.

After some troubleshooting, we found that the defective pages became corrupt as soon as the property Preamble was edited.

The solution was to rename the property “Preamble” to something else. It seems any property at all named “Preamble” will cause this error. Why that causes corrupt pages though, remains a mystery.

Environment:
EPiServer CMS 7 patch 2 with “EPiServer 7.1″ Add-On package. (7.0.586.8 + 7.1 Add-ons)

Custom settings for link properties in EPiServer CMS

April 1st, 2013

Even though a solution for this is already out there, albeit somewhat incoherent, way too many EPiServer websites lack the ability to limit the selection of pages editors may choose from when selecting a link in Edit mode. Editors cost money, and we need to keep them efficient and happy; that is in fact one of the primary objectives of a CMS system.

Read the rest of this entry »

Configure IIS to permanently (301) redirect to www domain address

April 1st, 2013

Here’s a tiny web.config file for making sure a website is configured to redirect (using 301 status code) to another website, often useful when a redirection to the www.domainname.com version is necessary. (Important for SEO)
Read the rest of this entry »

Get nice exception output from service for Ajax

April 1st, 2013

Debugging REST services called by AJAX can be tiresome, so here’s an easy way to get a nice formatted error output from the response.
Read the rest of this entry »

EPiServer custom property: Multiple Category checkbox list from specific sub category

April 1st, 2013

Sometimes editors have to select multiple categories from a long list, including other category nodes which might not be relevant for that page.

This is a custom property which you can configure to only list categories from a certain category parent. The editors can then select multiple categories directly from a list of checkboxes.
Read the rest of this entry »

Provider load failure (in an EPiServer website)

August 8th, 2012

I recently got the exception “System.Management.ManagementException: Provider load failure” in a EPiServer CMS 5 website.
Read the rest of this entry »

Javascript files, CSS files and images inexplicably requires login in EPiServer

June 17th, 2012

I recently experienced some files, such as javascripts and images, could not load in a website running EPiServer. When testing with the url directly to one of these files the EPiServer login page appeared. Logging in wouldn’t even help.

After checking file rights I noticed that the file had an unusual attribute, which caused the EPiServer login page to appear; “Encrypt contents to secure data”. I’m not sure why that attribute was set, but it seems the Windows built in ZIP extractor set the attribute automatically when extracting an entire folder. Extracting using 7-Zip did not result in the attribute being set.

Anyway, to remove the attribute just go to properties, click Advanced button and remove the Encrypt contents to secure data attribute.
…and don’t use the Windows ZIP tool. Ever.

Block autosubmit of form when pressing enter inside a text field

March 11th, 2012

This little javascript can be used to block the sometimes unwanted autosubmit behaviour of a form when the user presses enter while the textfield is active. (JQuery required)

Usage: <input type=”text” class=”blockautosubmit” id=”email” />

?View Code JAVASCRIPT
1
2
3
4
5
$('input.blockautosubmit').keypress(function(e) {
    if (e.keyCode == 44 || e.which == 44 || e.keyCode == 13 || e.which == 13) {
        return false;
    }
});

Extension for getting friendlyUrl when all you have is the internal url in EpiServer

January 23rd, 2012

Here’s a simple extension method for EPiServer when you need to get the friendly url from an internal url.

Note the last line checking if the Uri is an absoluteUri first. If you try to get the AbsoluteUri if it’s not you will get the following exception:
InvalidOperationException: This operation is not supported for a relative URI. This operation is not supported for a relative URI.

?View Code CSHARP
1
2
3
4
5
6
public static string GetFriendlyURL(this string internalURL)
{
   var url = new UrlBuilder(internalURL);
   EPiServer.Global.UrlRewriteProvider.ConvertToExternal(url, null, System.Text.UTF8Encoding.UTF8);
   return url.Uri.IsAbsoluteUri ? url.Uri.AbsoluteUri : url.Uri.OriginalString;
}

Get typed pagedata by page guid in EPiServer CMS

January 3rd, 2012

In EpiServer you might sometimes need to get PageData, preferably typed, from a page guid.

Here is a simple method for getting a page only by sending a guid as an argument, which we can do thanks to the PermanentPageLinkMap class, and results of other pagetypes than the requested are ignored, as well as any permanent links which are file links.

?View Code CSHARP
1
2
3
4
5
6
7
8
9
10
11
12
13
public static T GetPage<T>(Guid pageGuid) where T : PageData
{
    var linkMap = EPiServer.Web.PermanentLinkMapStore.Find(pageGuid) as PermanentPageLinkMap;
    if (linkMap != null)
    {
        var page = DataFactory.Instance.GetPage(linkMap.PageReference);
        if (page != null && page is T)
        {
            return (T)page;
        }
    }
    return null;
}

Tested in EPiServer CMS 6, but should work fine in version 5 as well.