Skip to content

Manually handle bots

webadvanced edited this page Jan 4, 2012 · 4 revisions

If you do not want Simple Honeypot to automatically redirect the user when the Honeypot fails, you can specify to manually handle the request.

The first option is on a per Acton basis, the [Honeypot(true)] attribute will take a Boolean for manuallyHandleBots. Pass true and then in the Action, use the Request.HoneypotFaild() method.

[Honeypot(true)]
public ActionResult SubscribeManual(EmailSubscriber subscriber) {
    if (Request.HoneypotFaild()) {
        return RedirectToAction("Han");
    }
    /*other code*/
    return RedirectToAction("Index");
}

Optionally, if you always want to manually handle the Honeypot failure you can set this in the App_Start by calling Honeypot.SetManuallyHandleBots(true).

Clone this wiki locally