When configuring your IIS 7 (or later) to allow custom extensions or extension-less URLs, especially if you’re running Kentico CMS in a virtual directory, you may receive the Lock violation error message. This typically doesn't allow you to specify the path settings in step 4 of the instructions for using cmspages/handler404.aspx described on this page.
The reason is most probably a locked defaultPath attribute in the httpErrors section. You can check and unlock it in IIS Manager. Select your site (IIS site) and open Configuration Editor (it is included in the Management section in the standard installation of IIS 7.5; if you are using IIS 7, you can download and install it as a part of the IIS7 Administration Pack).
In Configuration Editor, choose webServer/httpErrors from the Section drop-down list.
If there is a lock icon next to the defaultPath attribute name, right-click on the attribute name and select the ‘defaultPath’ Attribute -> Unlock Attribute action from the context menu. If the option is missing in the context menu, you will probably have to unlock it on a higher level in the IIS tree, i.e. on the parent site or on the root of the server.
Click Apply to save the changes and from now, the Lock violation errors shouldn’t appear.