Cut, copy, and paste methods are not allowed in ASP.

Source: Internet
Author: User
工欲善其事, its prerequisite

In a Web page developed by ASP, it is sometimes necessary to prevent users from pasting the copied password and to prevent the user from copying the article directly into the text box. The way to do this is to write code that prohibits pasting text directly where the control is restricted. However, this is not very convenient, if a page has 5 TextBox control, this time must be separate for each control is written to prohibit copy, paste code, resulting in a lot of work. Let's take a look at the specific operation below.

The first step is to create a new empty WebForm page.

In the second step, add several TextBox controls to the WebForm.

In the third step, add oncut= "return false" to the body tag. Oncopy = "return false;" Onpaste = "return false;"

Finally run through the browser, all the controls on the page cannot be pasted, cut, copied. The test results are as follows

Cut, copy, and paste methods are not allowed in ASP.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.