I would probably do something where the first step forces them to enter a username and password. Check it out, if itβs good, move them to the flag-enabled view that asks them to answer the question. If they do not succeed, write them out, download them, whatever. I do not think that this is possible in one view, if you do not make a partial view, and if they leave without completing the authentication process, you write them out and clear their cookie.
---- EDIT ----- On the other hand, you can make a partial view, just do not write them down until they complete the second part of the partial view. Some psuedo code:
public ActionResult Login(){ get username and password off the view if its valid render a partial view that asks for the secret answer if thats valid forms auth login else try again, get booted, or whatever else get booted, try again, whatever }
source share