Could someone sanity check this for me? Create two pages, Test1.aspx and
Test2.aspx, like so:
-----------------------------------------------------
<%@ Page ClassName="Test1"%>
hello from test1
-----------------------------------------------------
<%@ Page ClassName="Test2"%>
hello from test2
-----------------------------------------------------
And a third called RunMe.aspx:
-----------------------------------------------------
<script runat="server" language="C#">
void Page_Load(object o, EventArgs e) {
IHttpHandler test1 =
PageParser.GetCompiledPageInstance(Request.ApplicationPath,
Server.MapPath("Test1.aspx"), Context);
test1.ProcessRequest(Context);
IHttpHandler test2 =
PageParser.GetCompiledPageInstance(Request.ApplicationPath,
Server.MapPath("Test2.aspx"), Context);
test2.ProcessRequest(Context);
}
</script>
-----------------------------------------------------
Put them all in a browseable ASP.Net folder and hit RunMe.aspx. You should
see this output:
hello from test1 hello from test1
Tests on both instances confirm that they are of type ASP.Test1, instead of
ASP.Test1 and ASP.Test2 as I would expect. Now, add the following
directives to RunMe.aspx:
<%@ Reference Page="Test1.aspx" %>
<%@ Reference Page="Test2.aspx" %>
Now touch (edit and save) Test1.aspx and Test2.aspx to recompile them, and
hit RunMe.aspx again. You should see:
hello from test1 hello from test2
So my questions are: why is PageParser returning instances of the same type
for two different file paths, and why does adding references to the pages
fix this?
Incidentally, if you take out the ClassName directives from Test1.aspx and
Test2.aspx, and remove the Reference directives from RunMe.aspx, PageParser
works as expected.
I am running 1.0.3705 on Windows XP Home, through Cassini.
Thanks for your time,
Jim