protected void nextButton_Click(object sender, EventArgs e) { try { String SessionCaptcha = ""; String captcha = CaptchaTb.Text; if (Session["captcha"] != null) { SessionCaptcha = Session["captcha"].ToString(); } if (SessionCaptcha.Equals(captcha)) { Response.Redirect("~/MemberSignUp.aspx"); } else { ImageVerifierService.ServiceClient verifier = new ImageVerifierService.ServiceClient(); String captchaService = verifier.GetVerifierString("5"); Session["captcha"] = captchaService; CaptchaImage.ImageUrl = "http://neptune.fulton.ad.asu.edu/WSRepository/Services/ImageVerifier/Service.svc/GetImage/" + captchaService; captchaErrorLbl.Text = "Wrong Captcha Entered"; } } catch { } }
// Generate new code image protected void refreshVerificationImage() { ImageVerifierService.ServiceClient verify = new ImageVerifierService.ServiceClient(); string verifyString = verify.GetVerifierString("5"); ViewState["verificationString"] = verifyString; verifyImage.ImageUrl = "http://venus.eas.asu.edu/WSRepository/Services/ImageVerifier/Service.svc//GetImage/" + verifyString; }
protected void getOtherImageButton_Click(object sender, EventArgs e) { ImageVerifierService.ServiceClient imgserviceclient = new ImageVerifierService.ServiceClient(); String capchavalue = imgserviceclient.GetVerifierString("5"); //get verifier string of 5 charecters Image1.ImageUrl = "http://venus.eas.asu.edu/WSRepository/Services/ImageVerifier/Service.svc//GetImage/" + capchavalue; Session["verifyStr"] = capchavalue; capchaValueTB.Text = capchavalue; }
// Generate new code image protected void refreshVerificationImage() { ImageVerifierService.ServiceClient verify = new ImageVerifierService.ServiceClient(); String verifyString = verify.GetVerifierString("5"); //get a new image if user gets captcha wrong Session["verificationString"] = verifyString; verifyImage.ImageUrl = "http://neptune.fulton.ad.asu.edu/WSRepository/Services/ImageVerifierSVC/Service.svc/GetImage/" + verifyString; }
protected void ReloadImageButton_Click(object sender, EventArgs e) { try { ImageVerifierService.ServiceClient verifier = new ImageVerifierService.ServiceClient(); String captcha = verifier.GetVerifierString("5"); Session["captcha"] = captcha; CaptchaImage.ImageUrl = "http://neptune.fulton.ad.asu.edu/WSRepository/Services/ImageVerifier/Service.svc/GetImage/" + captcha; } catch { } }
protected void Page_Load(object sender, EventArgs e) { Response.Clear(); ImageVerifierService.ServiceClient fromService = new ImageVerifierService.ServiceClient(); string myStr = fromService.GetVerifierString("5"); Session["generatedString"] = myStr; Stream myStream = fromService.GetImage(myStr); System.Drawing.Image myImage = System.Drawing.Image.FromStream(myStream); Response.ContentType = "image/jpeg"; myImage.Save(Response.OutputStream, ImageFormat.Jpeg); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string capchavalue = ""; ImageVerifierService.ServiceClient imgclient = new ImageVerifierService.ServiceClient(); capchavalue = imgclient.GetVerifierString("5"); Image1.ImageUrl = "http://venus.eas.asu.edu/WSRepository/Services/ImageVerifier/Service.svc//GetImage/" + capchavalue; Session["verifyStr"] = capchavalue; capchaValueTB.Text = capchavalue; } }
protected void Button4_Click(object sender, EventArgs e) { ImageVerifierService.ServiceClient image = new ImageVerifierService.ServiceClient(); try { string genstr = image.GetVerifierString(TextBox5.Text); Image1.Visible = true; Session["genstr"] = genstr; Image1.ImageUrl = "http://neptune.fulton.ad.asu.edu/WSRepository/Services/ImageVerifier/Service.svc/GetImage/" + genstr; } catch (Exception ex) { Label3.Text = ex.Message; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Image1.Visible = true; ImageVerifierService.ServiceClient client = new ImageVerifierService.ServiceClient(); verificationString = client.GetVerifierString("7"); Stream stream = client.GetImage(verificationString); string savePath = Server.MapPath(@"Images\hw.jpg"); //String saveLocation = Path.Combine(Request.PhysicalApplicationPath, @"App_Data\"+"myImage.jpeg"); System.Drawing.Image image = System.Drawing.Image.FromStream(stream); image.Save(savePath, System.Drawing.Imaging.ImageFormat.Jpeg); string imageName = "~/Images/hw.jpg"; //Image1.ImageUrl = "C:\\VSProjects\\TravelGuide\\TravelGuide\\App_Data\\myImage.jpeg"; Image1.ImageUrl = imageName; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { try { ImageVerifierService.ServiceClient service = new ImageVerifierService.ServiceClient(); String captchaString = service.GetVerifierString("5"); //get the captcha string with length 5 Session["captcha"] = captchaString; verifyImage.ImageUrl = "http://neptune.fulton.ad.asu.edu/WSRepository/Services/ImageVerifier/Service.svc/GetImage/" + captchaString; //add captcha to image } catch { } } }
protected void verificationButton_Click(object sender, EventArgs e) { try { String cap = ""; String captcha = enteredCaptcha.Text; //text that the user entered if (Session["captcha"] != null) { cap = Session["captcha"].ToString(); } if (cap.Equals(captcha)) { Response.Redirect("~/Account/Register.aspx"); //if they entered the correct captcha information then send them to registration page } else { ImageVerifierService.ServiceClient verifyService = new ImageVerifierService.ServiceClient(); String captchaService = verifyService.GetVerifierString("5"); Session["captcha"] = captchaService; verifyImage.ImageUrl = "http://neptune.fulton.ad.asu.edu/WSRepository/Services/ImageVerifier/Service.svc/GetImage/" + captchaService; verificationError.Text = "Wrong Information"; //user entered wrong captcha } } catch { } }
protected void Button1_Click(object sender, EventArgs e) { //TextBox1.Text = verificationString; if (TextBox1.Text.Equals(verificationString)) { Response.Redirect("MemberRegistration.aspx"); //Image1.Visible = false; } else { Label1.Text = "Try Again"; ImageVerifierService.ServiceClient client = new ImageVerifierService.ServiceClient(); verificationString = client.GetVerifierString("7"); Stream stream = client.GetImage(verificationString); string savePath = Server.MapPath(@"Images\hw.jpg"); //String saveLocation = Path.Combine(Request.PhysicalApplicationPath, @"App_Data\"+"myImage.jpeg"); System.Drawing.Image image = System.Drawing.Image.FromStream(stream); image.Save(savePath, System.Drawing.Imaging.ImageFormat.Jpeg); string imageName = "~/Images/hw.jpg"; //Image1.ImageUrl = "C:\\VSProjects\\TravelGuide\\TravelGuide\\App_Data\\myImage.jpeg"; Image1.ImageUrl = imageName; } }
protected void btn_newIMG_Click(object sender, EventArgs e) { ImageVerifierService.ServiceClient client = new ImageVerifierService.ServiceClient(); verifier = client.GetVerifierString(5.ToString()); Image1.ImageUrl = "http://neptune.fulton.ad.asu.edu/WSRepository/Services/ImageVerifier/Service.svc/GetImage/" + verifier; }