Disable Right Click and Ctrl Keys in ASP.Net

Submitted by planetsourcecode on
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