Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change page location at run time

Tags:

asp.net

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.

like image 444
Pankaj Mishra Avatar asked Oct 26 '09 13:10

Pankaj Mishra


2 Answers

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

like image 111
Pankaj Mishra Avatar answered Oct 20 '22 01:10

Pankaj Mishra


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.

like image 23
erikkallen Avatar answered Oct 20 '22 00:10

erikkallen