Disable Right Click and Ctrl Keys in ASP.Net

We can easily disable right click and control keys in asp.net.In come circumstances.We want to disable the right click so that the user can not copy from or to the asp.net web page.In most of the web application it can be use in any possible condition. for doing this we have two possible ways: 1). Using asp.net method, which is used when we don't want to show message to the user In this we are making "oncopy","onpaste","oncut" we used "return false" 2). Using JavaScript, which will provide a message to the user(alert message) for doing this simply add java script into the head section of the web page where we want to restrict the user form the specified keys Untitled Page Note: you can place this function to MASTER PAGE, if we want this into many different pages Now we have to call this function into our pages, using this coding
Right click disabled textbox


Ctrl key disabled


Another method to disable Cut,Copy and paste in textbox

About the author: PlanetSourceCode.in is a place for all developer providing free source codes, articles, complete projects,complete application in PHP, C/C++, Javascript, Visual Basic, Cobol, Pascal, ASP/VBScript, AJAX, SQL, Perl, Python, Ruby, Mobile Development
Submitted byAnonymous (not verified)on Tue, 06/30/2009 - 15:55

In this code funtion ParseInt(code)==17 is used. From this what is the value for 17. What it should be returned..?
Submitted byAnonymous (not verified)on Wed, 07/08/2009 - 04:19

In reply to by Anonymous (not verified)

1) 17 == CTRL Key 2) True / False -- It is checking the number for every key that is pressed and if CTRL is pressed then the warning pops up...that is if you set it up correctly.

Add new comment