New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Error: Web.config registration missing! The Telerik dialogs require a HttpHandler registration in the web.config file.

Problem

Error: Web.config registration missing! The Telerik dialogs require a HttpHandler registration in the web.config file.

Web.config Registration Missing error

Description

To enable the RadEditor dialog to work, you need to register their HttpHandler in the web.config file as shown in the Mandatory Additions to the web.config article:

<httpHandlers>
    ...
    <add path="Telerik.Web.UI.DialogHandler.aspx" verb="*" type="Telerik.Web.UI.DialogHandler" validate="false" />
</httpHandlers>
...
<system.webServer>  
    <handlers>    
        ...    
        <add name="Telerik_Web_UI_DialogHandler_aspx" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" />  
    </handlers>
</system.webServer>

The use of an HttpHandler could lead to one of the following errors:

Solutions

The dialog handler is not registered in the web config

The dialog handler can be easily added automatically to the web.config file through the control's Smart Tag. You can see the help for more information: Controls > Editor > Dialogs see the help for more information: Controls > Editor > Dialogs.

URL rewriter scenario

In CMS scenarios, when some URL rewriter module overwrites the URLs of the editor's dialogs even if the dialog handler of the dialog is registered properly in the web.config file. To fix the URL rewriter problem exclude the editor dialogs from the URL rewriting routine. To do this, simply add the Telerik.Web.UI.DialogHandler.aspx file to the if () statement that checks the request URL:

if ((currentURL.Contains("/cms/")) && (currentURL.EndsWith(".aspx")) &&    
    !currentURL.EndsWith("Telerik.Web.UI.DialogHandler.aspx"))    
     ... 

This way the request for the dialog aspx will not be handled by your module and the dialog will load OK.

Note: ISAPI Fiter such as MS URLScan (urlscan.dll) could mess up the url calls and cause this error too.

URL Routing

You have registered a RESTful WCF service and the RadEditor spell check functionality and dialogs are not working.

The requests for the Telerik HttpHandlers should be excluded from the routing that is added with the RESTful WCF service via the following code in Global.asax:

void Application_Start(object sender, EventArgs e)
{
    // Code that runs on application startup
    System.Web.Routing.RouteTable.Routes.Ignore("{*dialogs}", new { dialogs = @".*Telerik\.Web\.UI\.DialogHandler\.aspx.*" });
    System.Web.Routing.RouteTable.Routes.Ignore("{*allaxd}", new { allaxd = @".*\.axd(/.*)?" });
    System.Web.Routing.RouteTable.Routes.Add(new System.ServiceModel.Activation.ServiceRoute("", newSystem.ServiceModel.Activation.WebServiceHostFactory(),typeof(CacheService)));
}

Friendly Urls

If for some reason the routes.Ignore method does not work in your WebForms scenario with friendly URLs, you can use a custom class that inherits the WebFormsFriendlyUrlResolver class. Inside this class you need to override ConvertToFriendlyUrl method and return the original path for the handler rather than a friendly URL:

RegisterRoutes method using a custom class for friendly URLs

public static class RouteConfig
{
        public static void RegisterRoutes(RouteCollection routes)
        {

            var settings = new FriendlyUrlSettings();
            settings.AutoRedirectMode = RedirectMode.Permanent;
            routes.EnableFriendlyUrls(settings,
                                  new IFriendlyUrlResolver[] {
                                 new CustomFriendlyUrlResolver() });

        }
  }

Custom WebForms Resolver code below

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using Microsoft.AspNet.FriendlyUrls.Resolvers;

public class CustomFriendlyUrlResolver : WebFormsFriendlyUrlResolver
{
    public CustomFriendlyUrlResolver() { }

    public override string ConvertToFriendlyUrl(string path)
    {
        if (!string.IsNullOrEmpty(path))
        {
            //how to ignore radeditor dialoghandler.aspx
            if (path.ToLower().Contains("telerik.web.ui.dialoghandler.aspx"))
            { // Here the filter code
                return path;
            }
            //how to ignore all aspx requests for url rewriting
            //if (path.ToLower().Contains(".aspx"))
            //{
            //    return path;
            //}
        }
        return base.ConvertToFriendlyUrl(path);
    }
}

Another HTTP handler is intercepting the dialogs request

The order of the entries in the <httpHandlers> section matters. The section is parsed from top to bottom. Also, if you have multiple web.config files, the handlers in the one in the root application folder will be used before the handlers in the web.config of a child folder. When a matching handler is found, the search stops and the handlers below it will never be executed. For example, if you have the following entries in your web.config:

<add path="*.aspx" verb="*" type="myHandler, myAssembly"/>
<add path="Telerik.Web.UI.WebResource.aspx" verb="*" type="Telerik.Web.UI.WebResource" validate="false"/>

When you make a request for an editor dialog, the first handler (*.aspx) will always match it, because it matches all aspx files. This means that our handler, which is bellow, will never be executed. In this case, changing the positions of the two handlers will fix the problem. As a general rule, keep more specific handlers at the top of the list and more general handlers at the bottom.

IIS 7 Integrated Mode

When a web site is running under IIS7 Integrated mode, the web server searches the HttpHandler registrations under the <system.webServer> configuration section instead of the standard <system.web> configuration section of the application configuration file.
 
All you need to do is to manually register the HttpHandler for the IIS7 Integrated mode by copying the Telerik HttpHandler to the <handlers> section of the <system.webServer> section group, delete the validate attribute and give it a name, e.g.

<system.webServer>
   <handlers>
    … 
      <add name="Telerik.Web.UI.DialogHandler" path="Telerik.Web.UI.DialogHandler.aspx" verb="*" type="Telerik.Web.UI.DialogHandler" />
    … 
   </handlers>
</system.webServer>

Nested web config files

In case there are more than one web.config files in the web app/site/project make sure that the required dialog handler registrations are available in the web.config file placed in the root of the app. For more information see this KB article: Register Telerik HTTP handlers in nested web.config.

The last resort solution

In friendly URLs, URL rewriting or routing scenarios, in SharePoint and MVC environments, it is a pretty common problem to face issues with modified and incorrect paths to the handlers that end with the aspx extension.

So instead of modifying your URL rewriter, routing or other URL modification-related code, the last resort solution allows you to configure the RadEditor control to look for a handler with a different extension that will be not touched by the URL modification code. In the example below, the aspx extension is changed to axd, but you can change the extension to whatever string that works for your app.

Open the web.config file and replace Telerik.Web.UI.DialogHandler.aspx with Telerik.Web.UI.DialogHandler.axd

<system.web>
  <httpHandlers>
    <add path="Telerik.Web.UI.DialogHandler.axd" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false"/>
  </httpHandlers>
</system.web>
<system.webServer>
  <validation validateIntegratedModeConfiguration="false"/>
  <handlers>
    <remove name="Telerik_Web_UI_DialogHandler_axd"/>
    <add name="Telerik_Web_UI_DialogHandler_axd" path="Telerik.Web.UI.DialogHandler.axd" type="Telerik.Web.UI.DialogHandler" verb="*" preCondition="integratedMode"/>
  </handlers>
</system.webServer>

Set the RadEditor's DialogHandlerUrl property to "~/Telerik.Web.UI.DialogHandler.axd", i.e.

<telerik:RadEditor ID="RadEditor1" DialogHandlerUrl="~/Telerik.Web.UI.DialogHandler.axd" runat="server"></telerik:RadEditor>

Additional Resources

In this section, you will find solutions for other problems that you may experience with RadEditor dialogs:

See Also

In this article