Sunday 15 February 2015

asp.net - How to prevent a logged in user from visiting the login page -


I am developing an application in MVC3 where I have a login page when a user enters the page, the problem Comes when he clicks the back button of the browser, then takes them to the login page which I did not want.

To reduce the long story, I have to work on log-in functionality like Facebook, Gmail, and others.

In a way I thought of working to find a way to control the browser back button after log-in and accordingly if it is clicked, the user will be able to access the same login page Redirect to. I have done a lot of research but nothing has to be done for me.

Anyone would appreciate it too much. Thanks in advance.

You can insert the following script in your login view (that user is included and the password field):

  & lt; Script type = "text / javascript" & gt; Window.history.forward (); & Lt; / Script & gt;    

No comments:

Post a Comment