E
erickephart
I have a login page (Login.aspx) that (after a certain number of failed
attempts) displays a captcha. In SignIn.ascx the image is displayed
via: '<img src="JpegImage.aspx">'.
Here is the JpegImage class:
public class JpegImage : System.Web.UI.Page {
private void Page_Load(object sender, System.EventArgs e) {
// Change the response headers to output a JPEG image.
this.Response.Clear();
this.Response.ContentType = "image/jpeg";
// Create a CAPTCHA image using the text stored in the Session
object.
CaptchaImage ci = new
CaptchaImage(this.Session[SN.Captcha].ToString(), 120, 40, "Arial");
// Write the image to the response stream in JPEG format and
dispose the image object
ci.Image.Save(this.Response.OutputStream, ImageFormat.Jpeg);
ci.Dispose();
}
}
The problem seems to be that the Session is lost in JpegImage.
this.Session[SN.Captcha] is set in SignIn.ascx.cs. All this seemed to
work fine before switching to .NET 2.0 from 1.1.
Ideas?
Thanks,
Eric
attempts) displays a captcha. In SignIn.ascx the image is displayed
via: '<img src="JpegImage.aspx">'.
Here is the JpegImage class:
public class JpegImage : System.Web.UI.Page {
private void Page_Load(object sender, System.EventArgs e) {
// Change the response headers to output a JPEG image.
this.Response.Clear();
this.Response.ContentType = "image/jpeg";
// Create a CAPTCHA image using the text stored in the Session
object.
CaptchaImage ci = new
CaptchaImage(this.Session[SN.Captcha].ToString(), 120, 40, "Arial");
// Write the image to the response stream in JPEG format and
dispose the image object
ci.Image.Save(this.Response.OutputStream, ImageFormat.Jpeg);
ci.Dispose();
}
}
The problem seems to be that the Session is lost in JpegImage.
this.Session[SN.Captcha] is set in SignIn.ascx.cs. All this seemed to
work fine before switching to .NET 2.0 from 1.1.
Ideas?
Thanks,
Eric