You can do this by creating a separate ASP.NET project (WAP or stock) and compiling it with Web Deployment projects into a single assembly. It works better with WAP projects because you'll get to set the class name rather than ASP.NET creating a dynamic name you'll have to figure out later with Reflector. Anyway once you've compiled with Web Deployment projects you have a single assembly that contains both the code behind and the compiled markup code.
Once you have that you can create a custom HttpHandler that can invoke your custom class based on your processing rules. You simply override the ProcessRequest method in the handler and call your Page Class ProcessRequest() method instead.
I wrote about this process here a while back:
http://west-wind.com/WebLog/posts/8191.aspx
As it turns out I've never actually put this to use though. I found it gets pretty tricky when you're dealing with related resources as you pretty much have to make sure all images and styles etc. are properly stowed into the assembly to ensure that the form is truly self contained. It's quite a bit of work of making this clean and easy but I suppose in some scenraios no extra resources may be required.
+++ Rick ---