Denied viewing product details, but need to return last visited product before login,

//product details page
        public ActionResult Product(int productId)
        {
            if (_workContext.CurrentCustomer.IsGuest())
            {
                return new HttpUnauthorizedResult();
            }
    var product = _productService.GetProductById(productId);