开发者

how to switch SharePoint 2010 master page for logged in user

开发者 https://www.devze.com 2023-04-11 10:30 出处:网络
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

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")

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号