Click here to Skip to main content
15,914,452 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello FRNDS,

I have an issue that relates to the 'Back' button in the browser.

I have my Menus in Master Page as Home,Display,Changepaswd,Logout.

When I click 'Back' in the browser, I expect to reach the previous page ( the previous page should be loaded) but it doesn't get loaded.

My code in PAGE_LOAD

C#
Response.Buffer = true;
       Response.ExpiresAbsolute = DateTime.Now.AddDays(-1d);
       Response.Expires = -1500;
       Response.CacheControl = "no-cache";


       if (Session["UserName"] == null)
       {
           Response.Redirect("Default.aspx");
       }



Please help me,

Thanks.
Posted
Comments
Sandeep Mewara 9-May-12 12:40pm    
You set 'Response.CacheControl = "no-cache";' then how do you expect to use browser back button?

1 solution

XML
<script type="text/javascript">
function goBack()
  {
  window.history.back()
  }
</script>
</head>
<body>

<input type="button" value="Back" onclick="goBack()" />

</body>
</html>



try this in javascript
 
Share this answer
 

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