Asp.net Disabling the Right-click Menu on Image by JavaScript:

JavaScript Disabling the Right-click Menu for an Image:



Disabling the Right-click Menu on Image by JavaScript:

In this post we give example of Disable right click on asp.net web application Image. The right click protection is basically used to protect the page image or content.  

Some time we can copy the Images from the asp.net web page. But if you have   some important Images and you want to disable copy then you can use this or for the disable 'right-click' features like copy & save Image from web page.

Protect Images Using JavaScript in asp.net image:

JavaScript can use to disable right click on images, menu Firefox, in all browsers, disable right click copy paste.

JavaScript Protect the right click on Image:

Write this with the asp.net Image tag.

          oncontextmenu="return false;"

Examples of Disable right click on images in Asp.net:

  <%@ Page Language="C#" AutoEventWireup="true" CodeFile="asppage.aspx.cs" Inherits="asppage" %>
         
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Disable right click on web page using javascript</title>
  
    <style type="text/css">
        #form1
        {
            height: 230px;
        }
        .style1
        {
            color: #990000;
            text-decoration: underline;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">     
    <div align="center">
   
    <h1 class="style1">Right Click Protected on Image in asp.net </h1>
    <h3>Example is here Right Click on Image and check it</h3>
   
    <asp:Image ID="Imag" runat="server" Height="157px"
           
            ImageUrl="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0zzVAuBeZvxEKek-b6d-SLekVU_zI0A_-cZfDhiZabvC5jFX0vAhvYYTz1YylWxEuk56B7pViUmKGonOeVvhEnZShCSzkrTiW3PVHsnxkiskQDeU1q_O0aPXv0LoRHecEiWHgwjttu0eR/s1600/asp-net+Programming-parijat.png"
            Width="190px" oncontextmenu="return false;" />
       
        <br />

        <asp:Image ID="Image1" runat="server" Height="63px"
            ImageUrl="~/bg.jpg" Width="279px" oncontextmenu="return false;" />      
   
    </div>
   
    </form>
</body>
</html> 


Other asp.net tutorial Post :




Comments

Popular posts from this blog