For my new web application, I am discussing the use of multiple views or conditional expressions in views.
In the sample script, various information will be displayed for authenticated users who have not authenticated. This could be solved in several ways.
- In the controller, check IsAuthenticated and return a view based on this
- In the view, check IsAuthenticated and show blocks of information based on this.
Pluses of several views: A smaller, less complex view - there is no logic in the view nearby
Pluses of individual views: fewer view files to support
The obvious disadvantages are the opposites of the pros: more files to support or more complex view files.
What do you prefer? What for? Any pros and cons that I have not outlined here?
Update: Suppose each view uses a layout page and partial views to abstract explicitly repeating code.
source
share