Am using struts2 to create login and logout functionality, when user login i will create the session for him,by using interceptor i will filter all users if they are in session or not if the session not created i will redirect the page to login........my problem is once i done logout that will redirect to the login page but when user click browser back button the page will get refreshed and again that will login ,,,,,,could anybody help me out from this problem
Thanks in advance
When you click "<-" button on browser the browser renders the page from its cache. So server does not know if you have click back button. In your case when user clicks back button, page is loaded from cache but it does not mean that session is again created for that user as logged in. When user will click on any authorized link on that page, your server side code will check that user has no valid session and login page will be returned.
Solution: However if you do not want user to get cached page then you can load a script say checkLogin.js for every page in your site. This script should be executed on load event of the pages. When user logs out, set a variable in cookie indicating that user has logged out. When user clicks back button then that script will be executed. That script will check, using the mentioned cookie variable, if user has logged out. If user had logged out then redirect to login page using javascript.
To avoid that refreshing i have redirect my page to menu after loginsuccess not forward i have escaped from that ghost problem
use like this in ur struts.xml
<result name= success" type="redirect">Menu.jsp</result>
thanks for all
Related
I am having difficulty with logging in and the functionality of the back and forward buttons associated with a user who is logged in. When I log into the application from the login page I am directed to a page (lets call it logged_home). If I press the back button I am returned to the login page. If I then press forward I am redirected to the "logged_home" page. The desired outcome when pressing the forward button at this point would be that the logged session is destroyed and if the person presses the forward button it remains or redirects back to itself i.e. login.
I have tried a number of approaches including clearing cache and destroying the session but havent found a workable approach as yet. In detail I have tried to instigate a session destroy every time the login page is loaded but it doesnt seem to work as intended. Any guidance would be appreciated.
I am using selenium in my application.
In login page, I enters username and password. and click on Login button.
When i click on login button, fields gets cleared and remains on same page without any error or warning message.
All the xpath values are correct.
When used in record and playback it works.
Please provide solution.
First see what is happening if u do it manual. If u provide login details to the page, is it redirect to next page or it remain the same page, I feel there is an issue in your test page.
(ASP.net)I have Log out Link in the home page and on clicking that link I am redirecting user to the log in page. When user click on back in browser it redirecting to home page even after log out.
How to stop this?
Mark home page controller action with authorize attribute.
I m trying to make one test app in windows phone 7.1 And I am using webBrowser control in my app and giving url of external website. User input login details in that form and press submit button. How I Can know the user is logged in.
Thanks,
You can track the URL the user is being redirected to, using the WebBrowser.Navigating event. Check the NavigatingEventArgs.Uri property.
Then you just need to work out the page that the login page redirects to, and if the user is navigating to that then they have successfully logged in.
I am having a session issue in codeigniter 2.0. The reason I think is it caching the page. Here is my problem.
I created a page and to access this page a user login is required. The login works fine. When I logout then I again redirected to login page and thats perfect. But if I click Back button of my browser then it again take me to that protected page. Technically this page is not accessible now because I have already logged out. If I put the link of that protected page in browser then it ask me to log in but after logout the browser back button is having the issue.
Can anyone please guide me with this.
Thanks
That's normal browser caching behavior. One of the way to fix that is to make sure that wherever users go from the cached page, their session will be checked, and if they've logged out in the mean time, they'll be redirected to the login screen, so no harm can be possibly done.