How can server-side redirect the web page to last page in the explorer history?
I have a web application and there are lots of different pages, some of which are small simple modal windows. These pages are in place for a long time, and deadline to the project is near, so I won't be able to change the architecture, (i.e. they will have to stay modal windows, at least for now anyway - I know lots of people are against modal windows use in web applications, but in my case, c'est la vie - I'm not the lead developer so i can't fight the argument as the deadline is within 3 weeks).
Anyway, back to my scenario. When you're in a list of, say, purchase orders (POList.asp) and you double click on a row, this modal window will open with details on it (DialogPODetails.asp). Of course when I call it, I pass in some parameters, such as the PO #, amongst others. When the modal window opens, the server side code will get the PO# and fetch information about the purchase orders with some inline SQLs, and display everything on the modal window.
So when I'm in the list, the address URL is like this:
What I don't want to happen is to have some hackers that will just try to type in the name of the modal dialog in the address bar, such as
The thing is, by typing in address like that, sometimes parameters are not passed in properly. If it is the case, PO# may be NULL, and so if the server side tries to build an inline SQL and execute it, it will cause an error.
Besides, users should never be allowed to change URL like that anyway.
What I like to see happen, is for the server-side to check that this is illegal, and instead of trying to build the inline SQL - seeing that there are no parameters, just send a message to the client side so the client will go back to the page before.
So if the system is now displaying POList.asp, and the user types in DIalogpODetails.asp in the address bar and hit enter, the system will then revert back to POList.asp. Don't even need to display any messages telling the users it's illegal. Just go back to POList.asp
Is it do-able?
I know that on client side, it is simple. On window onload, I just check to see if running window.dialogWidth will cause an error - if it does, the window is not a modal window, so just do a client-side history.back().
I just don't know how to do it on server side.