How to switch Sharepoint 2010 depending on the logged in user?
an example :
开发者_开发知识库I want to make "mycustompage.master" as master page for users in group "mysiteowners" and "v4.master" as master page for the rest of users.
thanks.
To set the master page file, use the following code
protected override void OnPreInit(EventArgs e)
{
if(UserIsInMySiteOwners())
{
Page.MasterPageFile = "~/mycustompage.master";
}
else
{
Page.MasterPageFile = "~/v4.master";
}
}
(You'll have to define your own method to determine if the user is in "Mysiteowners")
精彩评论