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
bruce barker - 03 Mar 2008 16:30 GMT
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)
> Hi,
> I use successfully the Page.LoadControl(string virtualPath) method (with
[quoted text clipped - 13 lines]
>
> Giorgio