Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I need to redirect the page to Error page when he clicks the back or refresh button. How to do this
Posted
Comments
[no name] 5-Dec-11 3:49am    
Out of curiousity, why would you do so? You'll make the users mad like hell with this one!

AFAIK, there is no reliable way to do this. The Back button is under browser control, and does not necessarily have to refer to the internet at all - it can just redisplay whatever information it has in cache, or directly, without even needing to execute any of the javascript on the page.

Why do you want to do this? I would think it would just unnecessarily annoy the users, without providing any real benefits.
 
Share this answer
 
Comments
priya from Madras 5-Dec-11 4:17am    
ya back button is under browser control but if u use window.onbeforeunload()
in javascript it display error message in popup ,but i need to redirect the error page
i find the solution myself: window.onbeforeunload = function () { var href="/KB/answers/Error1.aspx";//(this is the redirect page url ) window.open(href); }
 
Share this answer
 
Why?

I think you want like this
Browser back button issue after logout[^]
 
Share this answer
 
Comments
priya from Madras 5-Dec-11 4:14am    
No actually, in process if user click the refresh or save button the page have to display like page expired
use this Authentication tags in ur web.config file

XML
<authentication mode="Forms">
      <forms loginUrl="~/Account/errorpage.aspx" timeout="2880" />
    </authentication>
 
Share this answer
 
v2
Comments
priya from Madras 5-Dec-11 3:59am    
nothing happened
priya from Madras 5-Dec-11 4:08am    
Help me ,

its urgent


Thanks in advance

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900