Rearrange your UpdatePanel like following:
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Image ID="imgCapcha" runat="server" Height="51px" Width="212px" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="imbReLoad" />
</Triggers>
</asp:UpdatePanel>
<asp:ImageButton ID="imbReLoad" runat="server" Height="31px" ImageUrl="~/hinhtrangtri/refresh.png"
OnClick="imbReLoad_Click" Width="33px" />
Replace your TaoAnhCapcha():
public void TaoAnhCapcha()
{
string[] Fonts = { "Arial Black", "Arial" };
byte bLenght = 6;
string chars = "12345678ABCDEFGHIJKLMNOPQRSTUVWXYZabdeqptmnghr"; ;
Bitmap bmp = new Bitmap(125, 30);
Graphics gr = Graphics.FromImage(bmp);
HatchBrush brush = new HatchBrush(HatchStyle.Wave, Color.White, Color.Wheat);
gr.FillRegion(brush, gr.Clip);
StringBuilder strCapCha = new StringBuilder();
Random Rand = new Random();
int x = 1;
for (int i = 0; i < bLenght; i++)
{
string schar = chars[Rand.Next(chars.Length)].ToString();
strCapCha.Append(schar);
Font font = new Font(Fonts[Rand.Next(Fonts.Length)], 12, FontStyle.Bold | FontStyle.Italic);
SizeF size = gr.MeasureString(schar, font);
gr.DrawString(schar, font, Brushes.Blue, x * 2, Rand.Next(2, 10));
font.Dispose();
x += 10;
}
Session["captcha"] = strCapCha.ToString();
if (Session["path"] != null)
{
System.IO.File.Delete(Server.MapPath("") + "/" + Session["path"].ToString());
}
string path = "hinhtrangtri/" + Request.UserHostAddress + Rand.Next(100) + ".gif";
bmp.Save(Server.MapPath("") + "/" + path, System.Drawing.Imaging.ImageFormat.Gif);
imgCapcha.ImageUrl = path;
Session["path"] = path;
}
======================
Working?