I'mm building an ASP.net site and I want to divide it into folder, but I want a masterpage in the main folder that everyone will access from anywhere how do I tell a page that it's master page is in another folder? (For example, think that I want my Login page within Users folder can access masterpage in main folder (Main folder > users))
2 回答
Set the path from the root folder of your web application to the desired master page file in the MasterPageFile
attribute of the @ Page
directive. For example if your web application is in folder C:\MyProjects\MyWebApplication (the folder where your Web.config
is located) and your master page file Bar.master
is located in the folder C:\MyProjects\MyWebApplication\Foo, then set MasterPageFile
to "~/Foo/Bar.master".
U can choose master page at the time you create other pages. so when you are creating the Login page choose master page from the Main folder