Hello.
If you want to combine ASPX template and Portal engine page (ASPX template on Portal engine site), it is possible according to following link:
http://devnet.kentico.com/docs/devguide/combining_aspx_templates_and_portal_engine_templates.htm. CMSPages/PortalTemplate.aspx page is something like physical master page, or wrapper for all pages loading on Portal engine site, so for some tasks it can be used like you used it already.
However, when using physical ASPX template, you can easily take any value from URL and run any custom login in code-behind of given page template, in proper method (Page_Load and so). You can easily retrieve URL value using some proper method from CMS.GlobalHelper.UrlHelper class (please see API Reference file) and access any control and its properties, placed on given ASPX template.
If this still does not help you, could you please describe required scenario more in details, using some particular example? Thank you.
Best Regards,
Radek Macalik