开发者

How to change page location at run time

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜