Aida E
Aida E

Reputation: 1100

ASP.NET MVC : handling multiple layout

I have diffrent group and I need to show the related page for each group. so when a user open the app, I need to first check the user's groupID, if it's 0 pop up a window and ask the group and save it, if it has groupID load the related page. I don't have one layout as a start page and it depends on the user's groupID which page should load up.

I find this topic related but I'm totally confused. I think all of this needs to be taken care of by controllers to check the groupID and load the related layout. which controller should take care of all this?

Upvotes: 0

Views: 152

Answers (1)

Amin Saqi
Amin Saqi

Reputation: 18967

HomeController. this controller usually is the first controller that receives user request. you should add your related code to the Index action method of HomeController.

However, if a user call a page different from your start page (something like : www.domain.com/some) that trick doesn't work.

To achieve it in these situations, you should add your code to your top level layout.

Upvotes: 1

Related Questions