New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Using Audio Code

In order for RadCaptcha to be accessible by visually impaired users, the control can generate an audio code. Every alphanumeric character is read out using the NATO phonetic alphabet.

To enable this functionality you need to simply set the CaptchaImage-EnableCaptchaAudio property to true.

This will cause a link button, that retrieves the audio code, to be rendered below the CaptchaImage. To control the visual appearance of the link button, the user should use the .rcCaptchaAudioLink CSS class.

Since the Q3 2013 release of Telerik® UI for ASP.NET AJAX, RadCaptcha has an option for enabling a random background noise for the generated audio code. This functionality can be used by setting the property CaptchaImage-EnableAudioNoise to true.

How the audio code is generated?

By default, the System.Speech.Synthesis namespace is used to "Speak" the randomly generated text code by default.

If you set the CaptchaImage-UseAudioFiles property to true, the audio code will be generated by concatenating .wav files from the application directory. This can be useful if you cannot provide elevated privileges for speech synthesis (see below), or it has poor performance, or you want to provide your own sounds.

In order for the Captcha to be able to output an audio file the web application must be run in a ASP.NET Full Trust level environment.

The application must run as a user account that has permissions to call the SpeechSynthesizer.Speak(textToSpeak) method on the server. Usually the user account does not have the needed permissions and the administrator has to grant them. For example in IIS 6+ the Application Pools run as the ApplicationPoolIdentity built-in account (this is by default) which does not have enough permissions to call SpeechSynthesizer.Speak(textToSpeak). To generate the code the Application Pools should have permissions as the LocalSystem built-in account.

In case the web application does not have enough permissions to "Speak" the text code, the audio file will be generated by concatenation of ".wav" files that correspond to the specific character from the text code. By default RadCaptcha will look for the files in the ~/App_Data/RadCaptcha directory, so you need to supply the folder and the files. You can copy the App_Data\RadCaptcha directory located in the App_Data folder of your Telerik® UI for ASP.NET AJAX installation. A different location for the audio files can be used by setting the directory path to RadCaptcha's CaptchaImage-AudioFilesPath property.

In order for the audio code to be generated correctly when concatenating files, there must be a .wav file for every possible character that can appear on the image, and the file must be named as the character itself - <Char>.wav (for example,. A.wav, B.wav, C.wav, 1.wav, 2.wav and so on).

Tutorial - How to configure RadCaptcha to generate audio code?

The following tutorial demonstrates how to configure RadCaptcha to generate audio code.

  1. Follow the steps from the "Getting Started" tutorial to create a web-site with RadCaptcha control.

  2. In the Solution Explorer, right-click the project and select Add > Add ASP.NET Folder > App_Data.

  3. Locate the App_Data folder in your Telerik® UI for ASP.NET AJAX installation.

  4. Copy the App_Data\RadCaptcha to the project's ~/App_Data folder.

  5. The project structure should now look like the screenshot below.

    Rad Captcha App Data

  6. Enable the CaptchaAudio feature by setting the CaptchaImage-EnableCaptchaAudio property to true.

  7. Press F5 to run the Application. RadCaptcha validates the input on a post back.


In this article