You will have fun with thi since if the user uses the back and forwad buttons in the browser that are not related to your back and forward buttons, it will probably screw up everything. Reason, back button on the browser does not hit the server.
Not sure what to say other than you need to store the page in some sort of array/object/etc on the server. Have form butons that post back to get the page or write them out on the cllient and change the window.location.href with a button click.
Have fun reinventing the wheel!
Eric