Assume you have mapped a URL to a Sharepoint Site and are accessing the site from the extranet. This sharepoint site gets accessed locally from a port other than 80.
If you develop a custom aspx page then you would generally put the page in the _layouts folder and the dll in the Bin folder of the Site:port Virtual directory.
The page would work fine if the user accesses the site from the Intranet using the local url i.e http://site:port
But try accessing the page using the mapped URL. It wont work.
What I had to do was to put the Dll of custom page in the Bin directory of site at port 80. This got the page working.