开发者

How to change page location at run time

开发者 https://www.devze.com 2022-12-09 16:45 出处:网络
I have por开发者_运维百科tal 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.

I have por开发者_运维百科tal 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消