This is my old code for that inside my Master Page
It's been a couple of years since I made this, your choice if you want to update it.
Protected Overrides Sub OnPreRender(ByVal e As System.EventArgs)
MyBase.OnPreRender(e)
Dim disAbleBackButton As String
disAbleBackButton = "<script language='javascript'>" & Environment.NewLine
disAbleBackButton &= "function noBack(){window.history.forward()}" & Environment.NewLine
disAbleBackButton &= "noBack();" & Environment.NewLine
disAbleBackButton &= "window.onload=noBack;" & Environment.NewLine
disAbleBackButton &= "window.onpageshow=function(evt){if(evt.persisted)noBack()}" & Environment.NewLine
disAbleBackButton &= "window.onunload=function(){void(0)}" & Environment.NewLine
disAbleBackButton &= "</script>"
Page.ClientScript.RegisterClientScriptBlock(Me.Page.GetType(), "backhistory", disAbleBackButton)
End Sub