Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
How to disable mouse right click's options on a web page using C#.
Posted 23-Nov-12 18:51pm
Dee_Bee3.5K
Comments
Philippe Mori at 24-Nov-12 9:01am
   
Even though it is relatively easy to disable right mouse click, it has very little benefit as it is very easy to display the menu anyway... and it is also very easy to display the source code of the site without using right mouse click. So in the end, it is almost useless to do that if the purpose is too increase your site security.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

hi dear
use below javascript on your web page
<SCRIPT TYPE="text/javascript">
<!--
//Disable right click script
//visit http://www.rainbow.arch.scriptmania.com/scripts/
var message="Sorry, right-click has been disabled";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
// -->
</SCRIPT>
  Permalink  
Comments
Dee_Bee at 24-Nov-12 1:14am
   
Can't I do it in server side using C#? in code behind(.cs file)?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Hi
try this out,
<body oncontextmenu="return false">
</body>
--Sowraaj
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 305
1 OriginalGriff 225
2 Kornfeld Eliyahu Peter 130
3 DamithSL 110
4 Peter Leow 95
0 OriginalGriff 7,355
1 DamithSL 5,199
2 Sergey Alexandrovich Kryukov 4,942
3 Maciej Los 4,906
4 Kornfeld Eliyahu Peter 4,514


Advertise | Privacy | Mobile
Web02 | 2.8.141223.1 | Last Updated 24 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100