You must Sign In to post a response.
  • Category: ASP.NET

    How to disable the cut copy select and right click from the webpage?

    Are you looking for information on online test application? Want to know how to disable the cut copy select and right click from the webpage? Read this thread to learn more about disabling certain options with examples.

    I want to make a simple demo application like online test. I Completed the full, but now my only need is that I want to disable the select ,cut ,copy and the right click option on my webpage with out using java script
  • #722004

    Try like this

    <asp:TextBox ID="YourTextboxId" runat="server" oncopy="return false" onpaste="return false" oncut="return false" ondelete="return false"></asp:TextBox>


    <script language="javascript" type="text/javascript">
    function nocutcopypaste()
    return false;

    <asp:TextBox ID="TextBox1" runat="server" oncopy="return nocutcopypaste()"> </asp:TextBox>

    Check the below link


    Thanks & Regards,
    Mahesh Durgam

  • #722026


    Step1: If you want to prevent copy whole content of web page then use on dragstart as false and on select start as false inside of body tag like below.

    <body ondragstart="return false" onselectstart="return false">
    // Your content placed here

    Step2: If you want prevent cut, copy, paste text in your text box then try like this way

    <asp:TextBox ID="TextBox1" runat="server" oncopy="return false" onpaste="return false"
    oncut="return false"></asp:TextBox>

    Your Hard work never fails

  • #722049
    Above answer looking good. You can also achieve this task in jquery.

    Jquery Example:-

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="">
    <title>How to Disable Copy, Cut and Paste Options in textbox using jQuery</title>
    <script type="text/javascript" src=""></script>
    <script type="text/javascript">
    $(function() {
    $('#txtusername').bind("cut copy paste", function(e) {
    <form runat="server">
    <asp:TextBox ID="txtusername" runat="server"></asp:TextBox>

    Thanks & Regards
    Nothing is mine ,Everything is yours!!!

  • #722056
    Thanks to all..
    Shalini Rathore

  • #722182
    Hi Shalini,

    Use the below body in your page to prevent copy , paste & cut.

    <body oncopy="return false;" onpaste="return false;" oncut="return false;">
    your content here...

  • #728293
    Copy and paste the following javascript in your web page:

    <script language="javascript" type="text/javascript">
    function disableselect(e) {
    return false
    function reEnable() {
    return true

    document.onselectstart = new Function("return false")

    if (window.sidebar) {
    document.onmousedown = disableselect // for mozilla
    document.onclick = reEnable

    function clickIE() {
    if (document.all) {
    return false;

    document.oncontextmenu = new Function("return false")

    var element = document.getElementById('tbl');

    element.onmousedown = function () { return false; } // mozilla


    Note: For mozilla add -moz-user-select:none in style of the body tag where you want to disable those options..

  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.