简体   繁体   English

ASP.NET:在运行时中的代码背后动态创建Masterpage和aspx页面?

[英]ASP.NET:Create dynamically Masterpage and aspx page in runtime in code behind?

I want to make dynamically an aspx page and master page in code behind and save in specific path. 我想在后面的代码中动态制作一个aspx页面和母版页,并保存在特定路径中。 I am searching for this but i find some codes like this: 我正在搜索此代码,但是我发现了一些这样的代码:

string filePath=MapPath("~/file.aspx"); 字符串filePath = MapPath(“〜/ file.aspx”);
string htmlText=" < % @ Page Language=\\ " C # \\ " % >\\ n < !DOCTYPE html> < h 1>Hello World < / h1>"; 字符串htmlText =“ <%@页面语言= \\” C#\\“%> \\ n <!DOCTYPE html> <h 1> Hello World </ h1>”;
// I put these space because dont change the statement in out put ;) System.IO.File.WriteAllText(filePath,htmlText); //我放置了这些空间,因为不要更改输出语句;)System.IO.File.WriteAllText(filePath,htmlText);

Please Refer this link. 请参考此链接。

Working with ASP.NET Master Pages Programmatically 以编程方式使用ASP.NET母版页

I hope you will get the solution here. 希望您能在这里找到解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM