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:
- The same .wsp package has been deployed to all the servers which implies the following
- 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)
- The code deployed is identical
- I can hit the audio files externally from IE by referencing their location under /_layouts/
- The Web.Config are identical
- I swapped the web.configs between DEV & SIT, nothing broke/worked
- I manually inspected the various sections (trust levels, etc) between the DEV & SIT web.configs, they are identical
- 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
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

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

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?
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

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

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

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!
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

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

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

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
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 HostType: Telerik.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.

Sorry for late reply,
I just got a chance to try your suggestion and it work nicely
Thank you for your help :)