Load Page aspx at runtime

G

Giorgio

Hi,
I use successfully the Page.LoadControl(string virtualPath) method (with
*.ascx files) and Control.Render(writer) to create template and then
serialize them into a stringWriter to store the result into a file.
I would like to do the same with some pages (file *.aspx), but i cannot find
a way to load the page file as I do with a *.ascx file (Page.LoadControl
method says that Page is not a Control).

Where is the method? How does the asp.net framework engine (of iis or
cassini) to do this job??
I've found System.Web.UI.PageParser.GetCompiledPageInstance method, but it
doesn't load controls, it only creates an instance of the class with
Controls collection empty (so Page.RenderControl() serialize empty string!)

Thank you

Giorgio
 
B

bruce barker

you found the correct method.

as your code is hosting the page, it need to call the page events and
implement the page lifecycle. you need initiial a viewstate, create a session
provider, create a request, form collection. etc. then fire oninit, onload,
prerender, etc.


-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,588
Members
45,099
Latest member
AmbrosePri
Top