Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create instance of an ASPX page programmatically and parse html

From the code on one page I want to be able to generate an instance of another page and parse the html from certain controls on that page.

this is what i have tried so far

var APIListPage = (APIList)BuildManager.CreateInstanceFromVirtualPath("~/APIHelp/APIList.aspx", typeof(APIList));
ParseHtml(APIListPage.pdfPage);

The problem is APIListPage.pdfPage is always null.

like image 524
user1450877 Avatar asked Nov 03 '22 19:11

user1450877


1 Answers

You must call the page instance's "ProcessRequest" procedure, to let it experience a full Page LifeCycle. It won't load just by creating the instance.

like image 85
Alexander Avatar answered Nov 10 '22 10:11

Alexander