views:

789

answers:

1

Is it possible to redirect to a different view from a controller? For example in this case all my controllers inherit from a custom controller that has a contructer that I want to redirect to different view if certain criteria is not meet.

Hope that makes sense.

Thanks

+6  A: 

You can RedirectToAction, then the action you redirect to can return a view. The easiest way to do this is:

return RedirectToAction("Index", model);

Then in your Index method, return the view you want.

John Sheehan
If I did it this way how do I return a specific view from a controller Action.
Gavin Draper
return View("ViewName");
Craig Stuntz