As i have followed certain links to which i used but none of the answers helped me.
Disabling backbutton of browser in C#
https://www.aspsnippets.com/Articles/Disable-Browser-Back-Button-using-JavaScript-jQuery-in-ASPNet-MVC.aspx
disable browser back button javascript
https://www.itsolutionstuff.com/post/how-to-disable-browser-back-button-using-jqueryexample.html
Following of the code which i have used in cshtml page.
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta Http-Equiv="Cache-Control" Content="no-cache" />
<meta Http-Equiv="Pragma" Content="no-cache" />
<meta Http-Equiv="Expires" Content="0" />
<meta name="viewport" content="width=device-width" />
<title>Index</title>
<script src="~/Content/js/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
//window.history.pushState(null, "", window.location.href);
//window.onpopstate = function () {
// window.history.pushState(null, "", window.location.href);
//};
});
//function disablePrev() { window.history.forward(1) };
//window.onload = disablePrev();
//window.onpageshow = function (evt) { if (evt.persisted) disableBack() };
//window.history.forward(1);
//function noBack() { window.history.forward(1); }
function disableBackButton()
{
window.history.forward()
}
disableBackButton();
window.onload = disableBackButton;
window.onpageshow = function (evt) { if (evt.persisted) disableBackButton() }
window.onunload = function () { void (0) }
</script>
</head>
<body önunload="disableBackButton()">
<div>
</div>
</body>
</html>
As i am using version of chrome Version 83.0.4103.116 (Official Build) (64-bit) and firefox version 78.0.2 (64-bit). Please suggest any other solution as none of the answer are working for me.