This is a total PITA. I thought the same thing Dr. Herbie suggested, and it worked, until I indeed came across some scripts like Ion Todirel warned against.
I'm already using custom project templates, but they only go so far. I need to modify the ASPX code (as in, add a bunch of controls) for each page generated based on different criteria. Also, each page needs to have a different title, etcetera.
Any other ideas? I'm almost ready to just read the whole thing into a massive string, find the opening and closing tags of the form element, and insert a string of code between it. Which sounds incredibly error-prone and unwieldy.