+2  A: 

There are many different ways to persist data across multiple requests.

  • Cookies
  • Database layer
  • View state (render the data down and pass it back up in each request)

to name a few. The simplest of these is probably a view state implementation. You can roll your own like this

<input type="hidden" name="question_1" value="<%=ViewData["question_1"]%>" />

This input will get reposted in the next submission, so you can keep track of the value.

public ActionResult Step1Post(string answer)
{
    ViewData["question_1"] = answer;
    return View("Step2")
}

public ActionResult Step2Post(string answer, string question_1)
{
    question_1; // the answer from step 1
    answer; // the answer from step 2
}
Joel Potter
Of course then the correct answer would be visible to the user, if they were to view the source of the page.
RexM
@RexM, Don't render the correct answer onto the page. Just the answer the user entered. Final validation should be done after the final step.
Joel Potter
A: 

you could also store it in session with a unique key guid and store only the sessionKey in the view as a hidden input

actually it might also depend on the amount of data you will store

Omu
A: 

It sounds like taskGenerator.GenerateTask() will give you some type of a task, but is that Task persisted anywhere? (Where does this method get the task from)?

If there is an ID associated with the Task, you can send the taskId down in your view and then look the task up again, when they answer. You can then grab the CorrectAnswer from that task and do your comparison.

RexM