Kullanıcı Dostu (User Friendly) CAPTCHA
Hepimiz uygulamalarımıza captcha controlü ekliyoruz. ama kullanıcılar direkt her sayfada karşılarına gelen bu kontrolden pek hoşnut değil.
Ekteki örnekte arka arkaya 5 response gerçekleşirse captcha gösteren bir uygulama var.
Sonucta arka arkaya gelen response bot olabilir ama tek gelen response kullanıcıdır.
Kullanıcıyı rahatsız etmemeyi hedeflemenizi öneririm.
public class SystemUser { public SystemUser() { FirstReqTime = DateTime.Now; ReqCount = 1; } public DateTime FirstReqTime { get; set; } public int ReqCount { get; set; } private bool captcha; public bool RequiersCapthca { get { if (ReqCount > 5) { TimeSpan ts = DateTime.Now - FirstReqTime; if (ts.TotalSeconds > 5) { captcha = true; } else { captcha = false; } } return captcha; } set { captcha = value; } } } public class BasePage : Page { public BasePage() { // // TODO: Add constructor logic here // } protected override void OnLoad(EventArgs e) { base.OnLoad(e); SystemUser scu = Session["CaptchaControl"] as SystemUser; if (scu == null) { scu = new SystemUser(); Session.Add("CaptchaControl", scu); } else { scu.ReqCount++; } if (scu.RequiersCapthca) { Session.Add("ShowCaptcha", true); } } }




