To block copy paste URL without login


In this resource I will explain how we can block the user to block copy and paste the URL after the login.This code will help you to block copy paste URL without login in same window, in another tab. When you login the portal and leads to another page,for sale order it is very difficult to procceed.The client will enter the data at the same time.This will cause error. How to restrict the user to copy and paste.

How to restrict the user to copy and paste


In this article I will explain how we can restrict the user or to block copy and paste the URL after the login.

For many occasions, we need not to allow users to copy / paste certain information.

As we know copy / paste can be done using either the right click of the mouse or using keys control+c, control+v etc.

So to disallow users to copy or paste we have to block by forcing the user to enter the login and password

This code will help you to block copy paste URL without login in the
same window or in another tab.

When you login the portal and leads to another page, for sale order it is very difficult to proceed, the client will enter the data at the same time, this will cause error.

This is C# Code for Web portal

Write this code in the pageload event of that particular aspx page


string PName = "";

if (Request.UrlReferrer != null)
{
PName = Request.UrlReferrer.Segments[Request.UrlReferrer.Segments.Length - 1];
}

if(PName=="")
{
Response.Redirect("~/Login.aspx");
}

if authentication is failing,

Check every Page if user is authenticated or not

If (User.Identity.IsAuthenticated)

{

}


Reference: Restrict copy and paste URL using ASP.NET


Comments

Author: priya05 Mar 2012 Member Level: Bronze   Points : 1

When user logs in to the system create a session key for the user and chk it all over to verify the identity of the session

if he/she directly pastes the URL the session key is not created,

so in this case u will chk for the session key, if it is not equal to null then only allow the user to login. else redirect him to the login page.

Guest Author: naina23 Mar 2012

hey thanx buddy..it helped me

Guest Author: vinith.R27 Sep 2012

thanks a lot.......



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: