There is a Event
Page_PreInit
which executes before your page render. You can add your code in preInit to apply master page as per your requirement.
protected void Page_PreInit(object sender, EventArgs e)
{
if (user == "admin")
this.Page.MasterPageFile = "~/Admin.master";
else
this.Page.MasterPageFile = "~/user.master";
}
For detailed description refer:
this link[
^]
Also refer similar QA:
here[
^]