I have two master pages. When the user logs in it should set first m开发者_如何学Goaster page as default master page. If other login it should set second master page.
You can specify the default master page to use in the web.config file, using the masterPageFile
attribute of the pages
element:
<system.web>
<pages masterPageFile="~/DefaultMaster.master" />
<!-- more configuration goes here... -->
</system.web>
The page will use that master page unless it has a MasterPageFile
specified.
As @RoBYCoNTe pointed out in the comments, you can set the MasterPageFile
property on your pages.
If each page inherits from a common BaseClass, you can set the MasterPageFile
property in your BaseClass to avoid having to do it on each individual page.
精彩评论