You can see the live demo here: Asp.net Captcha Control
The image is generated by the CAPTCHA class. When click of refresh button,a new CAPTCHA image will be generated.
The CAPTCHA image is generated by CaptchaHandler and random code is generated to display with image. This code is stored on session variable and would be verified against entered textbox value while submitting form.