Creating a tab in standard contexts and calling custom page on it is one of the very common tasks that we do for large scale customizations. Generally what we do for this is, we create asp page and set context based on against which primary entity we are creating that tab. In the page we write an asp code depending on the functionality required.
Now, if there are lots of such Custom tabs available under single context then there might be some navigation problems occurring from nowhere. We came across one more such navigation problem which seems to be very interesting. Navigate through the couple of custom tabs at a time and then click on Main Menu tab. Suddenly you will find the SQL error on the page that loads. This is not the only problem that occurs, but also sometimes the page loses its primary entity context and then crashes in navigation.
We had posted a small but very useful script to handle the navigation issues in the Custom Pages. You can go through the below link to refer to the same. You can put this script in every custom page and it will handle the back/forward and much other navigation problems like the one mentioned above automatically.