Multiple HTTPHandlers

3 posts, 1 answers
  1. John W Wilson
    John W Wilson avatar
    12 posts
    Member since:
    Mar 2009

    Posted 04 Aug 2009 Link to this post

    I'm new to ASP.NET, so bear with me.

    I'm trying to implement a Captcha control.  Following the instructions in your demo I added the control, activated the handlers via the smart tags in web.config, set a couple of properties and tried to test.  The application failed with the error:

    'System.InvalidOperationException = {"'~/Telerik.Web.UI.WebResource.axd' is missing in web.config. RadScriptManager requires a HttpHandler registration in web.config. Please, use the control Smart Tag to add the handler automatically, or see the help for more information: Controls > RadScript.'

    Previous code has already added an HTTP Handler with the same path and verb.  My HTTPHandlers section looks like:
          <remove verb="*" path="*.asmx" />
          <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
          <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
          <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
          <add path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI" validate="false" />
          <add path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false" />
          <add path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" validate="false" />
          <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" validate="false" />
          <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.CaptchaImageHandler" verb="*" validate="false" />

    This means that the last Handler wins (or so I understand from ).  Reversing the order of these handlers gives me an error relating to the loading of the captcha control itself.

    1) What am I doing wrong if anything?
    2) Is the 2nd path as shown above correct? If not what should it be? If it is, can I combine these two statements and if so how?

  2. Answer
    Pero avatar
    1156 posts

    Posted 06 Aug 2009 Link to this post

    Hello John,

    When there is a RadScriptManager on the page, its httpHanlder has to be enabled first. Because the RadCaptcha uses the same httpHandler there is no need to register this httpHandler from the captcha's smart tag (in fact the link to register the httpHandler is not present in the smart tag anymore).

    Both of the paths are correct, but you need to use only one handler (as you said it is pointless because the last handler wins) - the one of type="Telerik.Web.UI.WebResource". There was an error even when the handler were reversed, because the type of the first handler is not correct (it is type="Telerik.Web.UI.WebResource, Telerik.Web.UI" and should be type="Telerik.Web.UI.WebResource"). 

    Here is how the code in web.config should look like, after the httpHandler has been registered from the RadScriptManager's smart tag:

           <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" /> 
           <add name="Telerik_Web_UI_WebResource_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" /> 

    Best wishes,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Hitesh
    Hitesh avatar
    3 posts
    Member since:
    Oct 2010

    Posted 15 Nov 2010 Link to this post

    Hi Pero, Many Thanks For answer !!!

    Thanks & Regards,
    Hitesh Panchal
Back to Top