Hello, i have to build a ASPNET website on which some functionalities will be available to logged in users. I'm trying to understand the right thing to to in building my pages.
I've found the following code in Page_PreInit:
protected void Page_PreInit(object sender, EventArgs e)
{
if (Membership.GetUser() == null) //check the user.. Weather user is logged in or not
{
this.Page.MasterPageFile = "~/General.master";
}
if (Membership.GetUser() == "ADMIN") //check the ADMIN.. Weather ADMIN is logged in or not
{
this.Page.MasterPageFile = "~/ADMIN.master";
}
else
{
this.Page.MasterPageFile = "~/Member.master";
}
}
..but i don't' know if this is the right approach in designing an app.
Is it right to switch at runtime Master page according to username/role?
Can you give me some suggestions?
Thanks in advance ! c.