Hi,
"
I am trying to create my own page through the Pages section on the Administration panel, and I have also been trying to code it different ways, but have unsuccessful, and I get the error above."
In order to dynamically add a new page you have to go to MonoX administation -> Page admin -> and on the right side you need to right click on the file list and add a new page based on available templates. If you are creating the page manually then you should use the standard ASP.NET approach and just use the MonoX master page in order to get the Web Part zone management functionality.
Programatically creating a MonoX page
1.
string
templateFile =
"PathToTemplateFileyouWantToUse"
;
2.
string
newFilePath =
"PathAndNewFileName"
;
3.
FileUtility.FreeFileCopy(templateFile, newFilePath,
string
.Format(
"({0}) {1}"
, Directory.GetParent(templateFile).Parent.Name, FileUtility.GetFileOrFolderName(templateFile).Replace(
".aspx"
,
string
.Empty, StringComparison.InvariantCultureIgnoreCase)));
4.
//instantiate page so everything could be written in the database - for example, all DocumentEntities are created in the database if a page contains HtmlEditors
5.
PageEntity selectedPage = DependencyInjectionFactory.Resolve<IPageBLL>().GetPage(FileUtility.PhysicalPathToUrl(newFilePath), Request.QueryString[ApplicationSettings.LocalizationSubFolder]);
6.
WebClient client =
new
WebClient();
7.
client.DownloadString(String.Format(
"{0}/{1}"
, ApplicationSettings.BaseSiteFullUrl, selectedPage.Url.Replace(
"/"
,
""
)));
Note: This is MonoX 5.1 based code
Regards