How do you dynamically assign a homepage?

Is it possible to dynamically assign a home page?

+3
source share
2 answers

Assign the master page to the PreInitwhos pages MasterPagethat you want to dynamically install:

protected void Page_PreInit(Object sender, EventArgs e)
{
    this.MasterPageFile = "~/YourMaster.master";
}
+6
source

You can assign the main page at a time Page_PreInitusing the property MasterPageFile.

Me.MasterPageFile = "~/masterpage.master"
+1
source

Source: https://habr.com/ru/post/1764866/


All Articles