In my magento instance guest checkout is enabled and configuration is set as follows:
System > Config > Customer > Redirect Customer to Account Dashboard after Logging in > NO
I want to redirect user to page he is requesting. Like if user has added some products to cart without logging in and if he clicks on go to checkout button, a login popup displays. Now when he logs in, he should be redirected to checkout page. Basically he should be redirected to the page based on which button is clicked (Go to checkout or View Cart)