CaptchaAudio Exception - Audio Captcha not working

19 posts, 1 answers
  1. Ali
    Ali avatar
    2 posts
    Member since:
    Jan 2011

    Posted 24 Jan 2011 Link to this post

    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

  2. Answer
    Pero
    Admin
    Pero avatar
    1156 posts

    Posted 26 Jan 2011 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ali
    Ali avatar
    2 posts
    Member since:
    Jan 2011

    Posted 27 Jan 2011 Link to this post

    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
  5. Pero
    Admin
    Pero avatar
    1156 posts

    Posted 28 Jan 2011 Link to this post

    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.
  6. Benjamin
    Benjamin avatar
    7 posts
    Member since:
    Jun 2008

    Posted 15 Feb 2011 Link to this post

    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?
  7. Pero
    Admin
    Pero avatar
    1156 posts

    Posted 17 Feb 2011 Link to this post

    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
  8. Benjamin
    Benjamin avatar
    7 posts
    Member since:
    Jun 2008

    Posted 17 Feb 2011 Link to this post

    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
  9. Pero
    Admin
    Pero avatar
    1156 posts

    Posted 18 Feb 2011 Link to this post

    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
  10. Ibrahim
    Ibrahim avatar
    5 posts
    Member since:
    Dec 2013

    Posted 30 Jan 2014 in reply to Benjamin Link to this post

    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).




  11. Slav
    Admin
    Slav avatar
    1355 posts

    Posted 04 Feb 2014 Link to this post

    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.
  12. Ibrahim
    Ibrahim avatar
    5 posts
    Member since:
    Dec 2013

    Posted 11 Feb 2014 in reply to Slav Link to this post

    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!
  13. Slav
    Admin
    Slav avatar
    1355 posts

    Posted 14 Feb 2014 Link to this post

    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.
  14. Herbert
    Herbert avatar
    4 posts
    Member since:
    Apr 2014

    Posted 06 May 2014 Link to this post

    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




  15. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 08 May 2014 Link to this post

    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.

     
  16. Herbert
    Herbert avatar
    4 posts
    Member since:
    Apr 2014

    Posted 08 May 2014 in reply to Dobromir Link to this post

    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.
  17. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 09 May 2014 Link to this post

    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.

     
  18. Herbert
    Herbert avatar
    4 posts
    Member since:
    Apr 2014

    Posted 13 Jun 2014 Link to this post

    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
  19. Vassil Vassilev
    Admin
     Vassil Vassilev avatar
    2 posts

    Posted 16 Jun 2014 Link to this post

    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.

     
  20. Herbert
    Herbert avatar
    4 posts
    Member since:
    Apr 2014

    Posted 04 Jul 2014 in reply to Vassil Vassilev Link to this post

    Hi Vassil

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

    Thank you for your help :)
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017