This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Disable previous page  RSS feed

 
mah kumar
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,
I am developing mail client project.
After logging out,if I press back button in the browser,it should not be
display the previous page.It will forward to login page.
How to do it?.
Please help me.
Thanks in advance.
 
Praful Thakare
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mah(esh) ,
After clicking on Logout..call and page ..which will redirect to login page...
say after clicking on logout I call Logout.jps which will look as follows
<%
...
.....//session invalidate and clean up ...
%>
<script>
location.href="Login.jsp";
</script>

Hope this will help you
Cheers
Praful
 
Bikramjit Singh Bajwa
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Well... where authentication required... On the top of the page(JSP or Servlet) you should first check whether the user is authenticated or not. if user is not authenticated then redirect to login page else let the user view that page. So when user gets logout, then distroy all its session (which were being created while log in), so that when user clicks on back button he will not be able to access that page.
chakk de.
Bikram
 
mah kumar
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,
Thanks a lot.
I had invalidate all the session.
If i press the back button the previous page should not be disply.
what we do.
Thanks
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was just wondering if JSF solves the back button problem? :roll:
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Firstly I believe it is better to use declarative rather than programatic authorisation and authentication. If you forget to add the code to a page or want to rewrite authentication mechanism, it's a problem with programamtic but is almost trivial if it just depends in settings in the server.
Have you tried adding some code to prevent the previous page from being cached? I don't have the code handy but I'll go find a link...
Dave
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is a link.
Dave
 
Faisal Khan
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David,
I have actually had this issue on going, I have placed the no caching code into my pages but still you can do back button and goto the page, without a valid session it will not let you do anything but it will be nice to completely avoid being able to go back and see the page at all.
Any advice?
FK
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Faisal,
I think we cannot avoid the user clicks the back button to go back to previous pages, unless you use JavaScript to disable the right click and the back button, but this makes the user feels inconvenience.
However, when we use session.invalidate(), when the user tries to perform some actions, like submit, etc, the action will be invalid as the session has been invalidated already.
Nick.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!