Click here to Skip to main content
13,000,324 members (75,890 online)
Rate this:
Please Sign up or sign in to vote.
See more:

i need to disable the print screen and ctrl keys in my silverlight web application.

if the user press the print screen or ctrl keys i need to pass a message "the keys are disabled".

how to do this..

need ur suggestions..

Posted 20-Sep-12 20:14pm
Updated 20-Sep-12 20:16pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

you wanna code in server side or client side ?
gopal_nivas84 24-Sep-12 2:33am
hi ambesha..
thanks for ur reply..

if a client the pressing the print screen key from his machine and i need to avoid that..

so for me whether its a client side or server side code but i need to control the print screen option from client machine during accessing my silverlight web appl.

need ur suggestions..

Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Friend, try the code below:
<script language="JavaScript"><!--
function clp_clear() {
   var content=window.clipboardData.getData("Text");
   if (content==null) {
<body onload='clp_clear()'>
<center><font color=darkgreen><font size=3><p>
...Press the [PrintScreen] or the [Alt+PrintScreen] key and try to paste the content in your favorite Picture Editor (Paint,...)...<br>
...Select text and try to paste the content in your favorite Text Editor (Notepad,...)...<p><font color=black><font size=2>
This small script clears the clipboard at runtime and disables screen capture process...but does not disable text selection..</center>
<hr>for more Ambesha blog, please visit <a href=""></a>[<a href="" target="_blank" title="New Window">^</a>] </body></html>

Please let me know if you want any specific...or server side code but in best practice for this task client scripting is appropriate. (please rate this reply)

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170624.1 | Last Updated 28 Sep 2012
Copyright © CodeProject, 1999-2017
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