on html.actionlink click go to previous page
Unless you're tracking what the previous page is on the server, why not just use the browser's internal history? In that case there wouldn't be a need for server-side code. You could just use something like this:
<a href="javascript:void(0);" onclick="history.go(-1);">Back to Details</a>
Or, separating the code from the markup:
<a href="javascript:void(0);" id="backLink">Back to Details</a>
<script type="text/javascript">
$(document).on('click', '#backLink', function () {
history.go(-1);
});
</script>
This would send the user back to whatever was the last page in their browser history. (Of course, if they reached that page from any other source then it wouldn't take them "back to details" but instead just "back".)
If you still want to use ActionLink
you can do something like as suggested by JuanPieterse
@Html.ActionLink("Back to previous page", null, null, null, new { href = Request.UrlReferrer})
You can use action
in controller
too. See answers to similar question here