user1450877
user1450877

Reputation: 421

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.

Upvotes: 5

Views: 1146

Answers (1)

Alexander
Alexander

Reputation: 2477

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.

Upvotes: 2

Related Questions