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

CaptchaAudio Exception - Audio Captcha not working

18 Answers 542 Views
Captcha
This is a migrated thread and some comments may be shown as answers.
Ali
Top achievements
Rank 1
Ali asked on 24 Jan 2011, 10:05 PM

Hi,

I'm utilizing the Telerik captcha control in a SharePoint environment as a security measure to protect forms against spamming. I have 3 layers in my setup. There's a Dev server (DEV), integration server (SIT) and ultimately the user acceptance test server (UAT). Although I have the exact same code, deployed to all the 3 environments, I get different behavior when it comes to Audio Captcha.

On my Dev, I'm able to hear the Audio Captcha once I click on the "Play Audio Code" link. On the other 2 servers, nothing happens. I investigated this further by finding the "guid" passed to the Telerik.Web.UI.WebResource.axd?type=cah&guid={guid} handler.

When I hit this handler from my dev box, I get the audio file. However, hitting the same handler (with a different guid of course) results in the following error in SIT & UAT:

CaptchaAudio Exception

 

RadCaptcha was not able to generate an audio code Please check the following:

  • Make sure that directory named RadCaptcha exists in the application’s APP_Data folder
  • Make sure that you have specified a valid path to the directory containing the audio (*.wav) files. Use CaptchaImage . AudioFilesPath property to set the path to the folder containing the files..
  • Make sure that there is an audio file for every possible character that might appear in the Textcode. The audio files must be named “Char”.wave. i.e. A.wav, B.wav, C.wav, 1.wave etc.
  • Make sure your application is running in Full Trust environment

Stating the obvious, I’ve checked all the above points and everything looks good to me.

Here are a few more points to consider:

  1. The same .wsp package has been deployed to all the servers which implies the following
    1. Audio files are copied to a folder called “RadCaptcha” that exists under the LAYOUTS folder (I’ve verified this on all the servers and the audio files DO exist)
    2. The code deployed is identical
    3. I can hit the audio files externally from IE by referencing their location under /_layouts/
  2. The Web.Config are identical
    1. I swapped the web.configs between DEV & SIT, nothing broke/worked
    2. I manually inspected the various sections (trust levels, etc) between the DEV & SIT web.configs, they are identical
  3. Below is the section where I configure the CAPTCHA in my code. I assume it’s correct as this works on DEV

// Add captcha to the right column

                    captcha = new RadCaptcha();

                    captcha.ID = "captcha";

                    captcha.ErrorMessage = "error";

                    captcha.EnableRefreshImage = true;

                    captcha.CaptchaAudioLinkButtonText = "Play Audio Code";

                    captcha.CaptchaImage.EnableCaptchaAudio = true;

                    captcha.CaptchaImage.AudioFilesPath = "/_layouts/myproject/forms/RadCaptcha";

// I added the line below later on to debug this issue – didn’t seem to have any effect

                    captcha.CaptchaImage.UseAudioFiles = true;

 

Any help is greatly appreciated,

Ali Pourmoghaddam

18 Answers, 1 is accepted

Sort by
0
Accepted
Pero
Telerik team
answered on 26 Jan 2011, 02:34 PM
Hi Ali,

I believe the problem is related to the location of the Audio files. Is it possible that you make it relative to the root directory of your application. The RadCaptcha uses the static MapPath method to resolve the path to the audio files.

All the best,
Pero
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Ali
Top achievements
Rank 1
answered on 27 Jan 2011, 10:29 PM
Pero,

Thanks a tonne for your great help. Adding Server.MapPath around the location of the audio files solved my issue.

I'm just curious to know why it ever worked on dev!

Best,
Ali Pourmoghaddam
0
Pero
Telerik team
answered on 28 Jan 2011, 06:27 PM
Hello Ali,

I suppose in your DEV environment the audio files where placed somewhere in the web-site's folder tree, which enabled the RadCaptcha to find the physical path of the files, by using the MapPath method.

I am glad that you resolved the issue on your online servers.

Best wishes,
Pero
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Benjamin
Top achievements
Rank 1
answered on 15 Feb 2011, 09:42 PM
I am having the same issue where Captcha audio is working locally and on our dev environment but not on the production environment.

RadCaptcha Folder is located inside the App_Data folder... All files are there on both production servers.

<telerik:RadCaptcha
              Display="dynamic"
              CaptchaTextBoxCssClass="FloatLeft"
              ID="RadCaptcha1"
              runat="server"
              ErrorMessage="Please type the characters you see"
              ValidationGroup="SubmitGroup"
              ForeColor="Red"
              CaptchaTextBoxLabelCssClass="captchaTextbox"
              CaptchaTextBoxLabel="<br/>Type the characters you see">
              <CaptchaImage EnableCaptchaAudio="true" ImageCssClass="rcCaptchaImage" BackgroundColor="#aaaaaa" TextColor="White" BackgroundNoise="None" UseAudioFiles="false" />
          </telerik:RadCaptcha>

Any help is appreciated.... Any settings I should be looking for on our production servers?
0
Pero
Telerik team
answered on 17 Feb 2011, 03:02 PM
Hello Benjamin,

I noticed that you have configured the RadCaptcha to not use the AudioFiles when generating the audio code:

<telerik:RadCaptcha
              Display="dynamic"
              CaptchaTextBoxCssClass="FloatLeft"
              ID="RadCaptcha1"
              runat="server"
              ErrorMessage="Please type the characters you see"
              ValidationGroup="SubmitGroup"
              ForeColor="Red"
              CaptchaTextBoxLabelCssClass="captchaTextbox"
              CaptchaTextBoxLabel="<br/>Type the characters you see">
              <CaptchaImage EnableCaptchaAudio="true" ImageCssClass="rcCaptchaImage" BackgroundColor="#aaaaaa" TextColor="White" BackgroundNoise="None" UseAudioFiles="false" />
          </telerik:RadCaptcha>

Set the UseAudioFiles property to true, and the audio code should be generated in the production environment also.

Regards,
Pero
the Telerik team
0
Benjamin
Top achievements
Rank 1
answered on 17 Feb 2011, 05:05 PM
Hi, I did that and it did not fix the problem.. but I do have it working now... here is what I did...

Instead of using asp script manager in my project... i switched to the rad script mananger... ( not sure if this fixed it... but including because it was one of the two things I did)

The second thing was that my live webconfig... had the line below:

   <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.CaptchaImageHandler" verb="*" validate="false"/>

which seemed on dev to no longer be needed.... I deleted this line from the webConfigs on my live servers and it now works fine...

I assume this was from a previous version... Everyone make sure your "handlers" sections are the same on dev and live for your webconfig... this cost me a lot of time troubleshooting.

-Ben
0
Pero
Telerik team
answered on 18 Feb 2011, 04:38 PM
Hi Benjamin,

I am glad you found a solution to your problem.

Yes, in the older versions of the RadCaptcha the type of the Captcha's handler was Telerik.Web.UI.CaptchaImageHandler. This has been changed and all of the Captcha's handlers are going through the Telerik.Web.UI.WebResource handler, and it is enough to register this handler in the web.config, and the Captcha's Audio and Image will be generated correctly.

Greetings,
Pero
the Telerik team
0
Ibrahim
Top achievements
Rank 1
answered on 30 Jan 2014, 07:00 PM
Hi Ben,

can you post what is right web.config file and telerik control properties in html you have for production servers..
I am using UseAudioFiles=true and AudioFilesPath="/layouts/RadCaptcha"
and in web.config file, i do have  type mentioned as Telerik.Web.UI.WebResource.axd

Its working fine for me at dev environment. when i access the Url (my dev) from other machine , some where it is coming and some where not (IE 10 windows server 2012).




0
Slav
Telerik team
answered on 04 Feb 2014, 01:34 PM
Hi Ibrahim,

You can check the following help article for information on how to register the HttpHandler: http://www.telerik.com/help/aspnet-ajax/captcha_getting_started.html.

Also, I would suggest making the path to the files, specified in the RadCaptcha, relative to the root directory of your application to ensure there will not be problems with accessing them, as mentioned earlier in the thread.

Regards,
Slav
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
0
Ibrahim
Top achievements
Rank 1
answered on 11 Feb 2014, 06:44 PM
Hi Slav,

Thanks for reply, instead of playing audio we are getting IE information bar prompt to download the .wav file.
due to our framework limitation, we are using jQuery.load('captcha.aspx') to render the captcha in divcontainer.

Please find the sample application CODE attached!

Please help us in ths!
0
Slav
Telerik team
answered on 14 Feb 2014, 04:51 PM
Hello Ibrahim,

Please check the following article on the matter: http://www.asp.net/ajaxlibrary/jquery_webforms_dynamic_load.ashx. As explained, if you embed ASP.NET controls into the page generated and returned by the .load() function, you shouldn’t expect them to behave like ASP.NET controls once returned and embedded as raw HTML. This means that you will not be possible to use RadCaptcha in such a way.

Alternatively you can try loading the page with the captcha in an iframe on the main page or by moving the captcha in a user control and loading this user control in an UpdatePanel.

Regards,
Slav
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
0
Herbert
Top achievements
Rank 1
answered on 06 May 2014, 09:50 AM
Hi All

I'm developing using Sitefinity 6.3 and using radcaptcha provided by sitefinity.
The captcha audio is working fine for all browser except IE 11. I have been looking for a solution and find out that this issue have been fixed ( http://feedback.telerik.com/Project/108/Feedback/Details/65898-the-audio-code-functionality-of-radcaptcha-is-not-working-under-ie11 )

My question is how to implement this hotfix to radcaptcha that come with sitefinity ?

Any reply or help is greatly appreciated

Thanks




0
Dobromir
Telerik team
answered on 08 May 2014, 11:35 AM
Hello Herbert,

You should be able to workaround this issue by adding the following javascript on the page with RadCaptcha.

<script>
 
    function testNavigatorPlugins(name) {
 
        var plugins=navigator.plugins;
        for(var i=0;i<plugins.length;i++) {
 
            var pluginName=plugins[i].name;
 
            if(pluginName.indexOf(name)!==-1) {
                return true;
            }
        }
        return false;
    }
 
    function testActiveXAvailability(objectName) {
        try {
            var control=new ActiveXObject(objectName);
            return !!control;
        }
        catch(e) {
            return false;
        }
    }
 
    Telerik.Web.BrowserPlugins.QuickTimePlayer = testActiveXAvailability('QuickTime.QuickTime') ||
                                                testActiveXAvailability('QuickTimeCheckObject.QuickTimeCheck') ||
                                                testNavigatorPlugins("QuickTime Plug-in");
     
    Telerik.Web.BrowserPlugins.WindowsMediaPlayer = testActiveXAvailability('WMPlayer.OCX') ||
                                                    testNavigatorPlugins("Windows Media");
 
</script>


Regards,
Dobromir
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Herbert
Top achievements
Rank 1
answered on 09 May 2014, 03:59 AM
Hi Dobromir

Its working.

Note : 
1. First try i put it inside <head></head> tag and its not working
2. Second try i move it from <head> tag to before </body> and its working

Thank's for your reply and help.
0
Dobromir
Telerik team
answered on 09 May 2014, 07:20 AM
Hello Herbert,

Please excuse me for not being clear enough.

Yes this code should be added after the script manager's declaration and yes the end of the form / body is ideal spot - the reason for this is that this code overwrites part of the detection framework used in the Telerik WebUI.

Regards,
Dobromir
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Herbert
Top achievements
Rank 1
answered on 13 Jun 2014, 07:14 AM
Hi All

Any idea how to enable audio CAPTCHA in Sitefinity 7 Form ?
I have check options in CAPTCHA widget designer and from administration setting page for Form controls
I don't see any

Thank you for your help and comments
0
Vassil Vassilev
Telerik team
answered on 16 Jun 2014, 01:00 PM

Hello Herbert,

You need to perform the following to enable Captcha audio:
1.Create a usercontrol file (only .ascx)
2.Add the following markup in it as shown in this screenshot:

<%@ Control Language="C#" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sf" %>
<%@ Register TagPrefix="telerik" Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" %>
 
<telerik:RadCaptcha runat="server" ID="radCaptcha" CaptchaImage-EnableCaptchaAudio="true" EnableRefreshImage="true" CssClass="sfFormCaptcha" CaptchaTextBoxCssClass="sfTxt" CaptchaTextBoxLabelCssClass="sfTxtLbl"></telerik:RadCaptcha>

3.Build the solution
4. In Administration >> Settings >> Advanced >> Controls >> ViewMap add as HostTypeTelerik.Sitefinity.Modules.Forms.Web.UI.Fields.FormCaptcha and as LayoutTemplatePath: ~/EnableCaptcha.ascx (in my case the ascx is in the root and named EnableCaptcha)

After restarting the application Sitefinity will use your custom template.

I hope this helps.

Regards, Vassil Vassilev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Herbert
Top achievements
Rank 1
answered on 04 Jul 2014, 06:53 PM
Hi Vassil

Sorry for late reply,
I just got a chance to try your suggestion and it work nicely

Thank you for your help :)
Tags
Captcha
Asked by
Ali
Top achievements
Rank 1
Answers by
Pero
Telerik team
Ali
Top achievements
Rank 1
Benjamin
Top achievements
Rank 1
Ibrahim
Top achievements
Rank 1
Slav
Telerik team
Herbert
Top achievements
Rank 1
Dobromir
Telerik team
Vassil Vassilev
Telerik team
Share this question
or