开发者

store previous page path in http session

As the application I'm building grows larger, there are time when I re-factor. Sometimes this breaks things. For example, the location the user gets directed to after submitting a form - or maybe canceling etc. An idea I had was to store the current page path (URL sans domain name) in the session. That way I can go back to the page the user came from, mimicking what happens when you close a dialog box on a desktop application. This would be much more flexible and easy to maintain. At least it seems t开发者_JAVA百科hat way.

The current changes I'm making will allow the user to navigate to the form from various places in the app. If the user is sent to a different page then s/he came from, s/he will become disoriented. I have 43 forms. This will soon increase to approximately 60.

Is this a bad idea for some reason I'm overlooking? Or is this a recommended approach?

[EDIT]

Please read the comments in the answer for a real reason:

"storing this in session can cause some issues on simultaneous requests"


Why don't your target script know where the user came from? I think it should, since each target processes specific form that has specific location.

If no - you can pass return_url in the hidden form field.

Imho it is a bad practice to store url in the session.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜