Click here to Skip to main content
14,981,768 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi...

I have to disable right click, save as, print screen, copy and paste in my project.. Actually i had done the same with the use of javascript.. But i dont want to use javascript... Is there any way to do with c# code... I think javascript is not secure bcoz if we disable javascript in browser then we can right click and do all things... So, i dont want to use it in javascript....

Any Suggestions warm welcome!!


Thanks
Posted
Comments
[no name] 11-Aug-11 6:44am
   
The only other way to protect your content is to not send it to the browser at all.

I often find that if you need to do this then a web site is probably the wrong vehicle for your application. Most savvy users will know how to get around most of these restrictions anyway and you need to ask yourself why you need to do it in the first place. Is this a client driven requirement? If so, ask them exactly why they want it. If they can't properly articulate the requirement they haven't thought it through and want it rather than need it.
   
Even if you did, it would not secure your data. Try an experiment: go to the menu (in Chrome it's the spanner) and select "View source".
Or, switch from your browser to the task bar. Press "Print Screen".

Your web app cannot stop either of these...

Nothing is secure, once it is presented to the user. Remember that.

In the UK, we used to have TV detector vans going around looking for houses where there was a TV operating, but no TV Licence. They worked by reading the radio emissions from the screen, and could get a good picture of what you were watching. Older (non-LCD) monitors work the same way as TV did...
   
There is no any other way to do this. You can disable the right click without the use of javascript by adding

<body oncontextmenu="return false;">
. But an experienced user can easily bypass this trick as well. Generally disabling right clicking is not considered a good habit.

Refer http://www.sitepoint.com/dont-disable-right-click/[^] to know why.....

Hope this helps.
All the best.
   

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