Asp.net programming we consider all important topic for knowledge about controls,web Services, JSON, Ajax, database, and interview related Question. In this Asp.net and sql server tutorial blog we give many examples of jquery as like How Play YouTube Video in Your Asp.net Website by URL, How to Play YouTube Videos in Asp.net by using Jquery , Jquery Change div background on mouseover in asp.net , JQuery UI Datepicker (Calendar) etc.

Friday, November 7, 2014

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="http://4.bp.blogspot.com/-6JXAPFRztnY/U57E0sE5ZDI/AAAAAAAAAOk/-paskUPeWfs/s1600/asp-net%2BProgramming-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 :




No comments:

Post a Comment