This is a migrated thread and some comments may be shown as answers.

Multiple HTTPHandlers

2 Answers 236 Views
Captcha
This is a migrated thread and some comments may be shown as answers.
John W Wilson
Top achievements
Rank 1
John W Wilson asked on 04 Aug 2009, 11:48 AM
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:
    <httpHandlers>
      <remove verb="*" path="*.asmx" />
      <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, 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=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" validate="false" />
      <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.CaptchaImageHandler" verb="*" validate="false" />
    </httpHandlers>

This means that the last Handler wins (or so I understand from http://msdn.microsoft.com/en-us/library/7d6sws33.aspx ).  Reversing the order of these handlers gives me an error relating to the loading of the captcha control itself.

so: 
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 Answers, 1 is accepted

Sort by
0
Accepted
Pero
Telerik team
answered on 06 Aug 2009, 02:36 PM
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:

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


Best wishes,
Pero
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.
0
Hitesh
Top achievements
Rank 1
answered on 15 Nov 2010, 11:15 AM
Hi Pero, Many Thanks For answer !!!

Thanks & Regards,
Hitesh Panchal
Tags
Captcha
Asked by
John W Wilson
Top achievements
Rank 1
Answers by
Pero
Telerik team
Hitesh
Top achievements
Rank 1
Share this question
or