I need to find whether the user clicking the browser back button or Refresh button.
I need to redirect the page to Error page when he clicks the back or refresh button.
I presume you want to do this because of post-back to avoid resubmitting some action or data right? ironically, this wasn't as huge of a problem back before asp.net webforms ... because you generally had to post to a different URL instead of the same one (much like asp.net mvc actually).
One trick I liked to use ... even though in the most technical of points is slower ... was to have an input page, and a post page. The HTML output of the post page was some super minimal HTML with a tiny javascript that replaced the current url (of the post page) in the browser's history with the result page (or even the original referring page if you really wanted). The result was when the user would click the back button, he'd be sent to the original input page, or if he clicked refresh, he'd already be on the new result page.