-
Notifications
You must be signed in to change notification settings - Fork 5
Manually handle bots
valmont edited this page Oct 30, 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(manuallyHandleBots: true)]
public ActionResult SubscribeManual(EmailSubscriber subscriber) {
if (Request.HoneypotFaild()) {
return RedirectToAction("BotTrap");
}
/*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). There is now no need to pass true to the [Honeypot] attribute however it is still required to annotate the Controller or Action with it.