Hi
Noe-a-days I am developing a we application using ASP.NET 3.5 with c#.
I want to know that if user once come at login.aspx page by click the browser back or forward button, the user can not go further with out successful log in.
i.e. google login page if we come at its loin page by click the browser button the password text box is blank and we are unable to back the page.
Same thing I want to use in my project.
I user Session to check but it can not help, it is just protect if any one copy the url (of after successful login) and past then come at login.aspx page
Loading
Rahul BhattPosted Jul 21, 2012, 1:47 AM
To Restrict back button functionality in browser,
Added following javascript on Master Page and Login Page
<script type="text/javascript">
window.history.forward();
function noBack() {
window.history.forward();
}
script>
Added on following javascript event in BODY tag evetnt
1. Onload
2. onPageshow
3. onunload
<body onload="noBack();" onpageshow="if(event.persisted) noBack();"
onunload="">
body>
Check above and let me know your feedback
Dadu DaPosted Jul 25, 2012, 1:39 AM
Thanks a lot to help mew
and i have two master page login page inherites a master page no1
thus i put it in other master page where the other page inherited to that master page no 2
thus if i successfuly login and then unable to use back key
and if i log out then use log key but browser only forward and backward only for the pages which are inherited to master page no 1 only
Rahul BhattPosted Jul 21, 2012, 4:03 AM
One for Login Page
Other for All other Page
then need to Added this Code in Both Master Page
If you have only one master page then need to added this code only in one Master Page.
If your Login page under master page then no need to added this code seperately on Login Page added into master page
Dadu DaPosted Jul 21, 2012, 2:30 AM
I have login page under a master page
I put code as you mentioned in master page, but in login page a error show that within 'td' tag 'body' tag not used.