Click here to Skip to main content
15,890,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can I disable mouse right click button on my web page in asp.net using c#.

Please Help Me.
Posted
Updated 14-Nov-11 1:47am
v2
Comments
LanFanNinja 14-Nov-11 6:45am    
Any one of the solutions below should help you out. However I would just like to add that all of these methods and more only stop some of the people some of the time. You CANNOT stop all of the people all of the time! This is true with most everything in life especially programming. See my comment for solution 1 for one of the reasons that I say this.
+5 to all below from me Merry Monday!

 
Share this answer
 
Comments
LanFanNinja 14-Nov-11 5:46am    
My +5
I would however like to add that a user could still right click using the keyboard i.e on windows by pressing Shift+F10 . But most people don't think to do this.
 
Share this answer
 
Comments
LanFanNinja 14-Nov-11 6:49am    
My +5
Hope following link helps you
SQL
Disabling the right click on web page

 
Share this answer
 
Comments
LanFanNinja 14-Nov-11 6:49am    
My +5
Try this Tip/Trick

Disable Right Click using jQuery[^]
 
Share this answer
 
Comments
LanFanNinja 14-Nov-11 6:49am    
My +5
Use this javascript inside head tag...
JavaScript
<script type="text/javascript">
<!--

//Disable right mouse click Script

var message="Function Disabled!";

///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")

// --> 
</script>
 
Share this answer
 
v2
Comments
LanFanNinja 14-Nov-11 7:05am    
My +5
Use this Code On Body Context
<body öncontextmenu="return false">
...
</body>
 
Share this answer
 
v2
Comments
Mas11 27-Jun-13 9:53am    
I dn't know ! why people don't like ur answer but this is best one :) 5* for this.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900