I'm building a user registration wizard with ASP.NET. I'm redirecting the user to a different view for each step of the wizard. Initially, I was using TempData to store values but I realized that a couple of my values will need to persist beyond one request.
So now I'm trying to use ViewData but the behavior is different. When using TempData, I am able to render the view with the data but when I use ViewData, I get "Object reference not set to an instance of an object" when it attempts to render the view.
When I use TempData, it works, but only for the next request (by design from my understanding).
Here is my code. Any ideas on what I'm doing wrong? Also, if anyone has suggestions on to better handle a user registration wizard, I'm all ears. Thanks.
ICompanyInterface service = new CompanyRepository();
bool compWebsite = service.CheckWebsite(model.Website);
if (compWebsite == true)
ViewData["CompanyInfo"] = service.GetCompanyInfo(model.Website);
View Complete Post