Login

Blog entries tagged with Code Samples

Sep
04

How to get the internal URL or page reference based on a friendly URL in EPiServer

Posted by: Ted Nyberg

I have previously described how to get the simple address of a page and how to get the friendly URL of a page in EPiServer. This post explains how to get the PageReference object or internal URL based on a friendly URL. The goal of the... [Read full article]

0 Comments

Sep
03

How to make virtual path providers work with precompiled EPiServer websites

Posted by: Ted Nyberg

Note: This is an experimental workaround. It is not supported by EPiServer nor Microsoft. Introduction Earlier I wrote a post on how you can Precompile your web site to publish it without source code or markup. Minutes after publishing it I was... [Read full article]

0 Comments

Aug
27

Using web parts in EPiServer

Posted by: Ted Nyberg

As Stein Viggo points out in his EPiServer on Steroids post, traditional page type templates can limit editor creativity. Having editors enter values for page properties and placing these values within well-defined templates can do miracles for... [Read full article]

0 Comments

Aug
18

Run a scheduled job as a specific EPiServer user

Posted by: Ted Nyberg

As noted in my post about how to Create a custom scheduled job in EPiServer all scheduled runs will execute as an anonymous user whereas jobs that are executed manually are run as the current EPiServer user. How to log on programmatically as a... [Read full article]

0 Comments

Aug
15

How to get the simple address of a page in EPiServer

Posted by: Ted Nyberg

The following code snippet shows how to retrieve the simple address of an EPiServer page. If you want to retrieve the friendly URL of an EPiServer page instead, please see my post on How to get the friendly URL of a page in EPiServer CMS. ... [Read full article]

0 Comments

Aug
08

Create a custom scheduled job in EPiServer

Posted by: Ted Nyberg

This post explains how to create a scheduled job in EPiServer CMS. Introduction A scheduled job in EPiServer is essentially a piece of code that will be executed repeatedly at a given time interval, or when an administrator manually executes it... [Read full article]

0 Comments

Jul
24

Implementing a custom URL rewrite provider for EPiServer

Posted by: Ted Nyberg

Introduction I'm a firm believer in avoiding querystring parameters in URLs, especially for public web sites. Security, SEO and esthetics are a few reasons why. Custom URL rewriting can help you avoid those ugly ampersands and question marks, even... [Read full article]

0 Comments

Apr
05

Using a single domain strategy with multiple languages in EPiServer

Posted by: Ted Nyberg

Introduction This post covers one way of enforcing a domain strategy for multi-language (or multi-division) sites. There are two common scenarios for multi-language site domain strategies: Use one top domain per language In this case, www.... [Read full article]

0 Comments

Mar
10

Using LINQ and EPiServer

Posted by: Ted Nyberg

Just as a brief proof of concept I decided to use a LINQ statement to retrieve and sort a list of EPiServer pages. If you haven't yet come across LINQ I would recommend Scott Guthrie's post on using LINQ. LINQ can be used to query a number of... [Read full article]

0 Comments

Mar
06

Modify and publish a page programmatically

Posted by: Ted Nyberg

Inspired by Marek's post on modifying existing pages I  decided to complement my post on programmatically publishing new pages with a post on how to modify and publish existing pages in EPiServer. 1. Why you can't modify a PageData object As Marek... [Read full article]

0 Comments

Mar
05

Create and publish a page programmatically

Posted by: Ted Nyberg

This post explains in detail how to programmatically create a page in EPiServer CMS 5. It also shows how to publish a page through code, even when the current user lacks the necessary permissions. 1. Specify where to publish the page Start off by... [Read full article]

0 Comments

Mar
02

Search by language branch in EPiServer

Posted by: Ted Nyberg

This post is a complement to my previous post about searching pages with EPiServer. I have gotten a few questions about how to limit a page search to include pages from a specific language branch. Since this is truly a basic requirement when... [Read full article]

0 Comments

Feb
26

Search for EPiServer pages based on properties

Posted by: Ted Nyberg

This post aims to clearly illustrate a way of searching for EPiServer pages based on property values. By specifying search criteria and a place to start the search you'll get a PageDataCollection containing all matching pages. The concept The... [Read full article]

0 Comments

Feb
11

Check to see if a page exists for a specific language branch

Posted by: Ted Nyberg

Have you ever wanted to know if a specific EPiServer page exists for a specific language? I recently came across an implementation that looked something like this:try { DataFactory. Instance. GetPage(myPageLink, new... [Read full article]

0 Comments

Feb
09

Programmatically configure customErrors redirects

Posted by: Ted Nyberg

I previously posted a possible solution for handling 404 exceptions in EPiServer websites, but here's an alternative and possibly more elegant way of configuring custom error redirects for EPiServer. What I wanted to accomplish I wanted to be able... [Read full article]

0 Comments

Feb
07

How to get the friendly URL of a page in EPiServer CMS

Posted by: Ted Nyberg

Maybe there are other posts about this, but I thought I'd share an easy way of getting the friendly URL of a page since I've gotten questions about it on numerous occasions:public static string GetFriendlyURL( PageReference PageLink, string... [Read full article]

0 Comments

Feb
07

Handle 404 exceptions in EPiServer CMS

Posted by: Ted Nyberg

As many of you know, there is a comprehensive 404 handler available for download through EPiCode. However, I just wanted a simple way of specifying a PageID and have that page act as a 404 response. Easier said than done it seems I actually got my... [Read full article]

0 Comments

Jan
17

Disable URL rewriting for specific URLs

Posted by: Ted Nyberg

There comes a time when you need to prohibit URL rewriting for specific URLs within your EPiServer CMS website. For example, I've implemented an ashx handler that is used to deliver vCard files on our company's web site. If I would insert a... [Read full article]

0 Comments

About

Ted Nyberg

Ted Nyberg

I work for the corporate communications consultancy Hallvarsson & Halvarsson in Stockholm, Sweden. My main focus areas are architecture, design and implementation of online applications such as public web sites and intranets.

Syndication

EPiTrace logger