EPiServer

You are currently browsing articles tagged EPiServer.

imageIn a larger organization it can be cumbersome to explain for the editors how to install the EPiServer ActiveX controls that provides you with some extended functionality.

Security restrictions can also be a problem for ActiveX controls. So why bother? Well you will miss the following functionality:

  • Spell checker, Microsoft Office Support
    A component that enables the Editor to use Microsoft Word spell checker.
  • Export to Excel, Microsoft Office Support
    A component that can export xForms data to Microsoft Excel.
  • Advanced File Upload
    A component that enables support for advanced file upload, for example drag-and-drop and multiple file upload.

Installation from your Browser

imageClick the Install-button on the Components tab on the Root/Welcome-page to install manually.

Automate installation or workaround security problems

Extract the DLL files inside the cab file to the client computer:
\<UI folder>\activex\episerverclientcomponents.cab

Run the following command to install:
regsvr32.exe EPiFileUpload.dll
regsvr32.exe EPiOfficeIntegration.dll

Creating a script or small msi package that automates the installation is not very complicated and saves the editors the task to install this themselves. Remember that Advanced File Upload will also require a permission for function to be setup in admin mode.

EPiServer Office Integration

You can use episerverofficeaddin.msi, in the same folder, to get the Office Integration installed. I have had problem with upgrading so I always uninstall existing version first and then reinstall the latest version.

This tool can be very powerful if used right. Read the Tech Note on Microsoft Office Integration before you try to use it. It will require changes to web.config  before you can test it.

Tags: , , , ,

imageSo you have created some web parts and they work fine on your test machine but when you want to register them on a test or production machine you only get a uninformative ‘The virtual path could not be loaded’.

I guess you have already checked that the path is correct several times and that you have deployed all DLL’s and ASP.NET files. What is wrong?

LoadControl() parses and compiles your markup

A quick look with reflection reveals the LoadControl() is called to verify that the web part really exists. When you ask ASP.NET for a user control it will parse the ASCX-file, generate code and then compile it.

So there is a lot that can go wrong and all exceptions from this process is swallowed by the user interface and replaced with virtual path could not be loaded.

A good way to actually see the exception is to create a dummy aspx file and register all user controls and reference them from markup. When you try to view the aspx file any compilation error from the user controls will surface.

Examine compile and pages tag in your web.config

The most common reason markup works fine on one machine but not another is differences in web.config. Check the compilation and pages tag and compare them for differences between the machines.

Tags: , , , ,

This might be obvious stuff for most seasoned EPiServer developers but I still think it is worth blogging about because I see these dangerous mistakes whenever I do a code review of an EPiServer project.

Null values

Remember that all EPiServer properties with an empty value never are stored in the database. If you access it from code, it will always be null – not an empty string, 0 or false as you maybe expected.

Why null? It is by design and is very convenient if you want to check if something is not set by an editor or does not exist on this page. You just have to compare with null regardless of data type.

Example – DO & DONT

This will throw NullReferenceException if value is empty or missing:
sb.Append(CurrentPage["MyProperty"].ToString());

StringBuilder.Append accepts null objects so this is better:
sb.Append(CurrentPage["MyProperty"]);

This will throw NullReferenceException if value is empty or missing:
<%= CurrentPage.Property["MyProperty"].Value.ToString()%>

Markup will accept any type and convert to string so cast is not needed:
<%= CurrentPage ["MyProperty"] %>

Other examples with fallback

If must have a string returned use as operator and ?? operator:
string x = ["MyProperty"] as string ?? string.Empty;

And for Value Type it is written like this: (thanks Henrik)
DateTime x = (DateTime)(CurrentPage[”MyProperty”] ?? DateTime.Now);
int i = (int)(CurrentPage[”MyProperty”] ?? 0);

If you need a fallback in markup the?? Operator can be used:
<%= CurrentPage[“Heading”] ?? CurrentPage.PageName %>

Use Default indexer

Remember that there is a default indexer on PageData that returns the value, too.

Example – DO & DONT

This expression:
<%= CurrentPage.Property["MyProperty"].Value %>

…is equivalent:
<%= CurrentPage["MyProperty"] %>

Common EPiServer Property Names

It is very common that Page Types in EPiServer has the following properties.

Heading (string)

Used for the h1-tag of the page. If not defined the page is coded to fall back to the PageName. (See public templates for example implementation). This makes it possible to use PageName for a shorter text in menus and the meta title-tag and have a little longer text for the actual h1-header.

MainIntro (string)

This property is commonly used to describe a page in Teasers on other pages and in search results. It is usually also used to generate the meta description-tag which can affect the description external search engines like Google show.

There are functions in EPiServer that uses MainIntro – like PreviewText() method on PageTemplateContainer (type of Container object in EPiServer PageList, PageTree, etc). It implements a fallback if no MainIntro exists to strip MainBody of HTML and use first 400 characters.

MainBody (string)

Almost always used for the body text of an page in EPiServer.

Read more

Read more about Properties with Special Functionality in EPiServer.

Tags: , ,

If you have problems with the EPiServer Scheduler Service unexcitingly stopping you can also turn on debug logging to get more clues.

Change EPiServer.SchedulerSvc.exe.config FILE

You need to add the following to the service’s config-file to get detailed call stacks for exceptions that occur in you web application:

<system.runtime.remoting>
  <customErrors mode="Off"/>
</system.runtime.remoting>

Update EPiServer.SchedulerSvc Registry

image Prepare a folder for the log file and make sure the account running the service has write access. I’m usually lazy and give everyone full access since this logging usually is not left on forever.

User RegEdit and change the ImagePath value for the EPiServer Scheduler Service to include a parameter with the log-filename.

HKLM\SYSTEM\CurrentControlSet\Services\EPiServer.SchedulerSvc
ImagePath = C:\Program Files\EPiServer.Scheduler\EPiServer.SchedulerSvc.exe D:\Log\EPiServer.SchedulerSvc.log

Be careful when you edit the Registry! I use to export the key to a file before I change anything so I can look at the original configuration.

See also: Auto Restart of EPiServer Scheduler Service

Tags: , , , , , , ,

imageThere are several functions in a EPiServer Web Application that rely on the Services installed by EPiServer Manager. For example delayed publish of a new version of a page at a specific time, mirroring of pages between servers, archiving pages that has past the stopped publish date and removing old pages from the waste basket.

Requirements for Scheduled Jobs in EPiServer

Several things must be true for tasks to be executed:

  • The Service must be running
    The service is installed and updated by EPiServer manager but you may have to configure it and setup the in the computers Administrative Tool for Services.
  • Each EPiServer Web must be allowed to use the Service
    There is only one instance of the Service but there might be several Web Applications. Each has a setting that controls if they are allowed imageto connect to the service or not. This often misunderstood setting is displayed on the Capability page in EPiServer Manager.
  • Each Job must be active and have a schedule
    You must also for each Web Application go to admin mode and enable each Scheduled Job by checking Active and give it a schedule.

The EPiServer Scheduler Service does not appear to be active

imageIf you have satisfied all requirements above and it suddenly stops working it can be an uncaught exception that halts your service.

My recommendation is always to configure the EPiServer Services to automatically restart if it should stop unexpectedly. This can be done from the Recovery Tab in the Properties for each Service.

Update

See also: Enable debug logging for EPiServer Scheduler

Tags: , , , , , ,

« Older entries § Newer entries »