Click here to Skip to main content
14,211,624 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hello friends,
I have created an application in mvc.In that application there is a form for add details to the database.So in the form there is a captcha image .i have written the code for update image using ajax while refreshing the captcha image.But the actual problem is when i click on the refresh button some characters appears in the place of image.How can i solve this problem?
my code is given below.
<img src="/{Controller}/ShowCaptchaImage" alt="Captcha"  width="238" height="53"/>

In my controller
public CaptchaImageResult ShowCaptchaImage()
       {
           //return new CaptchaImageResult();
           Session["CaptchaImageText"] = GetCaptchaString(6);
           CaptchaImageResult ci = new CaptchaImageResult(
       this.Session["CaptchaImageText"].ToString(),
       200, 50, "Century Schoolbook");
           this.Response.Clear();
           this.Response.ContentType = "image/jpeg";
           ci.Image.Save(this.Response.OutputStream, ImageFormat.Jpeg);
           ci.Dispose();
           return ci;



Thank you developer Guys,
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Cookies | Terms of Service
Web01 | 2.8.190619.2 | Last Updated 12 Jul 2011
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100