Dynamically changing Master Template in ASP.NET MVC

前端 未结 3 1650
执笔经年
执笔经年 2020-12-30 16:12

I have the requirement to support different Master pages on my application (ASP.NET MVC). What is the recommended way to:

  1. Pass the master page name to the view
3条回答
  •  一个人的身影
    2020-12-30 16:21

    you could throw the master page name into the session, but sessions are unreliable. i'd recommend throwing it in a db instead.

    once you're in the page, you can change/set the master page by accessing page.masterpagefile. it's a string; just pass the .master name in.

提交回复
热议问题