Mathias Kunto Archive

Internet Explorer loses Referrer when redirecting or linking with JavaScript

I came across another Internet Explorer feature today as I was debugging a piece of code related to adding referrer URLs when submitting input forms. It worked perfectly on all versions that I tried of Firefox and Chrome, the referring URL was there, but when it came to IE it just would not give me the address. As the failing incoming link was being syndicated …

Supplying EPiServer scheduled jobs with parameters through Admin Mode

I have always missed a way of supplying arbitrary input parameters to EPiServer scheduled jobs through the Admin Mode scheduled job interface. As Stefan Forsberg laughingly pointed out to me when I told him about my POC for this functionality (something in the lines of “Oh, I see you have found yourself a hammer.”), I seem to have found a way of using control adapters …

Allowing web editors to apply PageType based filtering on the EPiServer edit mode PageTree

When you have an EPiServer installation containing thousands of different pages built up by far-too-many page types, locating pages of just one of them may turn out to be just a little too time consuming. Since I have grown to like the adaptive control approach more and more lately, I decided to create a filtering mechanism for cleaning out dead ends in the EPiServer page …

Recursively finding an ASP.NET control with a specific ID

I wrote a short recursive method for locating specific controls while having no idea of where they are in a nested structure; actually, I added one dynamically and needed to find it again. This will return the first control matching the ID below the supplied root control, if it can find one of course. FindControlRecursively method Usage As Page is also a Control it may …

Making the EPiServer scheduler run your Windows PowerShell scripts

Some time ago I wrote a post about retrieving and updating the MaxMind GeoIP database using Windows PowerShell scripts, and suggested the possibility to have the Windows Task Scheduler automating the process. Mostly for my own amusement, I decided to have a go at making the EPiServer scheduler do the work as well; perhaps there would also be scenarios when web administrators would need to …

Surviving IE, or: How to render different markup depending on devices and browsers

The short answer would be, “Create a control adapter, add it to your .browser file and have it applied using browser recognition”. If you want the longer verion, you will have to continue reading. First, let us start with some basics on control adapters. I find them extremely useful tweeking built-in EPiServer (the CMS that I most often find myself working with) controls; especially adding …

Keeping your hair from turning gray, or: How to style the asp:FileUpload control using control adapters

The other day, I got a question from a former collegue of mine who was having trouble styling the ASP.NET FileUpload control, as it renders into a particulary nasty bit of HTML; i.e. an <input type=”file” /> tag. He told me that he would love for it to be just another textbox along with a stupid button. If you have ever tried applying any type …

GeoIP database update in multiple webserver environment using Windows PowerShell scripting

The MaxMind GeoIP database (shipped with EPiServer Framework) is rather useful when wanting to show geographically specific information to visitors as they surf around the site. Since mapping the correct requests to the proper regions may be rather important generating value, the need of having a fresh database copy quickly comes into focus. Manually updating the database is of course not at all complicated; it …

Using Windows Task Scheduler to automatically run PowerShell scripts

Windows PowerShell scripting is a powerful way of automating otherwise tiresome and error prone manual tasks. I recently looked into how I could have Windows running my scripts for me. It is not difficult, but it still took some poking around to get done. New tasks are added using the Create Task option in the Actions area. The General tab will let you decide how …

Programmatically created pages getting wrong master language in migrated EPiServer environment

I ran in to a problem with my migrated EPiServer 4 website when creating new pages programmatically. The old site was using English as the master language, but my new one would be all in Swedish. I had used the version of the Advanced Language Manipulation Tool that Mari Jørgensen updated to convert my pages, as well as the SQL provided by Dane Richards (comment …

Changing default values on built-in EPiServer properties

A client was using CurrentPage.Changed.ToShortDateString() for displaying a Last updated date in the inner footer of their pages. They often, however, forgot to select the Mark page as changed-checkbox on the Settings tab, and asked me if it was possible to have it selected by default. Here is a simple way to do it. Global.asax.cs In your Global.asax.cs file, add an event handler to the …

Must select Show data for all pages checkbox in Edit mode to find submitted EPiServer XForms Form Data

I noticed a problem with a customer’s XForm earlier; no matter how many times I posted data, I was not able to find it through the Edit mode Form Data-tab. It was not until I marked the checkbox Show data for all pages that I got any hits. The XForm data exist in a table called tblXFormData in the EPiServer database. Checking the content of …

EPiServer Indexing Service unable to find index or segments exceptions

I got two exceptions today trying to use an EPiServer SearchDataSource in order to find files in the VPP directories. Not rocket science solving them, but I thought that I would make a short post anyway hoping it might make somebody’s life easier. System.IO.IOException: \\server\VPP\Global\index not a directory The first exception occured as my VPP folders did not yet contain index directories. The EPiServer Indexing …

The ‘Microsoft.ACE.OLEDB.12.0’ provider is not registered on the local machine exception

I got this exception when setting up an old website on a new 64-bit Windows Server. The system was using an old Access database for keeping statistics information, which did not seem to like the new environment. As I did not have Microsoft Office installed on the server I had to download the 2007 Office System Driver: Data Connectivity Components from the Microsoft website. After …

Allowing web administrators to dynamically update EPiServer language files

When working with EPiServer sites, a not all that uncommon type of support case is the need to change text on a page which is not editable through the Edit mode. Quite often, this text is located in language files on the web server, and it may be rather tiresome for web editors having to send change requests to the support or development team just …

Simple handling of legacy URLs to an EPiServer 4 site migrated to a later version

When a customer wants to move their site from version 4 of the EPiServer platform to a later one, the URLs will change. It is very likely that so will the ids for the migrated pages. Here is a simple method for retaining functioning bookmarks, unbroken links from other websites, keeping RSS readers happy, while at the same time feeding search engines 301 – Permanently …

Removing empty fields from EPiServer XForm e-mails

A customer asked me to see what I could do for their XForm order notification e-mails today. Apparently the department handling their incoming orders was receiving really long e-mails with loads of superfluous information; this as every field in the XForm was being submitted to them, and not just the ones containing data. This is the default behaviour of the XForm functionality, which of course …