How to restrict the user to copy and paste the URL in browser address bar in ASP.NET
In such cases what we have to do is, we will make use of UrlReferrer property.
Please check below code, you may write below code in the page load of each page you wanted to restrict copy and paste of URL to open the page.
string strPreviousPage = "";
if (Request.UrlReferrer != null)
{
strPreviousPage = Request.UrlReferrer.Segments[Request.UrlReferrer.Segments.Length - 1];
}
if(strPreviousPage =="")
{
Response.Redirect("~/Login.aspx");
}
Above code will forcefully redirect to Login page if user copy and paste the URL to open the page.
Also along with this code you might be using your regular authentication code.
Please post your queries if you have any with this code and technique.