mister_don
New Member
I'm stuck while experimenting with captcha handler in asp.net, any help would be appreciated.Imagine we have such a handler:\[code\]public void ProcessRequest(HttpContext context){ var text = generateText(); using (var image = generateImage(text)) { context.Response.Clear(); context.Response.ContentType = "image/jpeg"; context.Session.Add("captcha", text); image.Save(context.Response.OutputStream, ImageFormat.Jpeg); }}\[/code\]then in some default.aspx we put:\[code\]<img src="http://stackoverflow.com/questions/12804200/<%=CaptchaImageUrl %>"/><p><%=Context.Session["captcha"]%></p>\[/code\]meaning that we would like to show captcha image and check captcha value stored in session. But the problem is that current session value in default.aspx is outdated by the side of captcha handler, and \[code\]<p><%=Context.Session["captcha"]%></p>\[/code\]will always return the previous captcha value. Any suggestions?