I have portal where lot of master page and all related page in root.
When user register his self then it will create a folder and copy all related file into the folder.
root master page and page url
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Layoutmaster.master.cs" Inherits="Layoutmaster" %>
<%@ Page Language="C#" MasterPageFile="~/MasterPage/Layoutmaster.master" AutoEventWireup="true" CodeFile="Home.aspx.cs" Inherits="Home" Title="Home" %>
Folder url of master page and page
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Layoutmaster.master.cs" Inherits="Layoutmaster" %>
<%@ Page Language="C#" MasterPageFile="~/SubDomain/1/MasterPage/Layoutmaster.master" AutoEventWireup="true" CodeFile="Home.aspx.cs" Inherits="Home" Title="Home" %>
I want to change the Master Page File '"~/MasterPage/Layoutmaster.master"' from MasterPageFile="~/SubDomain/1/MasterPage/Layoutmaster.master" Please help me to change the location I have no any idea.
We can select different master page for any page aspx.
This is code
this.MasterPageFile = "Master Page path";
This will work
For more information Solution
You'll probably need to parse the aspx file to do this.
Another possibility would be to create a virtual path provider which would redirect the requests to the master page depending on where the file is.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With