I should probably explain what I'm doing in more detail.  I've built a
testing framework for ASP.Net pages, built on NUnit.  Tests are written as
methods on a Page, either in pre-compiled assemblies or in .aspx files for
on-the-fly compilation.  So I need to automate the execution of these tests,
catch exceptions, pass a mocked-up context in and get a response back.  As
this needs to be done reflectively, the whole @Reference thing won't be much
use (and I also want to be able to run these tests from a pre-compiled
assembly).

I've got it working by Server.Execute'ing the pages before calling
GetCompiledPageInstance as you suggested, so I'm happy, but I'd still like
to de-mystify the whole parse-and-compile process ('cause I think it's
awesome :-) ).

Cheers,

Jim


----- Original Message -----
From: "Jon Flanders" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 28, 2003 6:58 PM
Subject: Re: [ADVANCED-DOTNET] Problem with ASP.Net's parser


> So could you have an .aspx file that has all the references in it (I
assume
> you are calling this from a handler), and then you can call
> PageParser.GetCompiledPageInstance on the "include" page, which will cause
> the right types to be associated with the right file names, and then when
> you call GetCompiledPageInstance on the "subtypes" they will be correct.
>
> Could this work for you?
>
> Like RunMe.aspx just has :
>
>
> <%@ Reference Page="Test1.aspx" %>
> <%@ Reference Page="Test2.aspx" %>
>
> And then your code could do this:
>
> public void ProcessRequest(HttpContext Context)
> {
> //make it compile the "super" page that has the reference directives
>
PageParser.GetCompiledPageInstance(Context.Request.ApplicationPath,Context.S
> erver.MapPath("RunMe.aspx"), Context);
> Context.Response.Write("<pre>"+st.ToString()+"</pre>");
> IHttpHandler test1
>
=PageParser.GetCompiledPageInstance(Context.Request.ApplicationPath,Context.
> Server.MapPath("Test1.aspx"), Context);
>  test1.ProcessRequest(Context);
>
>  IHttpHandler test2
>
=PageParser.GetCompiledPageInstance(Context.Request.ApplicationPath,Context.
> Server.MapPath("Test2.aspx"), Context);
>   test2.ProcessRequest(Context);
>
> }
>
> -----Original Message-----
> From: Moderated discussion of advanced .NET topics.
> [mailto:[EMAIL PROTECTED] Behalf Of Jim Arnold
> Sent: Friday, February 28, 2003 10:33 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [ADVANCED-DOTNET] Problem with ASP.Net's parser
>
>
> Because I'm not creating the page from another page.
>
> Jim
>
> ----- Original Message -----
> From: "Jon Flanders" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, February 28, 2003 4:45 PM
> Subject: Re: [ADVANCED-DOTNET] Problem with ASP.Net's parser
>
>
> > Sorry - can you explain why you have to call GetCompiledPageInstance and
> not
> > use @Reference?
>

Reply via email to