I found a bug in ASP. NET about "submit by carriage return? You must press enter to submit more than one text field. SERVER: buttonx_click can be intercepted.

Source: Internet
Author: User

ASP. NET:
If there is only one text field, press enter to submit it. The Webserver buttonx_click cannot be intercepted and can only be intercepted in page_load on the webserver, it's no different from submitting a traditional web form to action CGI!
If there is more than one field of the text type, press enter to submit it. You can intercept the webserver buttonx_click field!

Test. aspx

<HTML>
<Script language = "C #" runat = Server>
Void button#click (Object sender, eventargs E)
{
// If there is only one text field, press enter to submit it. The Webserver buttonx_click cannot be intercepted.
Label1.text = "you entered:" + textbox1.text;
}
Void page_load (Object sender, eventargs E)
{
// If there is only one field of the text type, press enter to submit it. The Webserver buttonx_click cannot be intercepted and can only be intercepted in page_load of the webserver.
// Button#click (null, null );
}
</SCRIPT>
<Body>
<Form runat = "server" enableviewstate = "false">
ASP. NET:
<Br> if there is only one text field, press enter to submit it. The Webserver buttonx_click cannot be intercepted and can only be intercepted in page_load on the webserver: <br>
ASP: textbox1: <br>
<Asp: textbox id = "textbox1" runat = "server" text = "ASP: textbox "/> after entering the information, press enter to submit. Note that the effect is different from that of clicking the submit button. <br>
If the following text fields are removed and only one text field exists, press enter to submit the fields, and the webserver buttonx_click cannot be intercepted, it can only be "intercepted" in page_load on webserver! It is no different from the traditional web form action CGI <br>
If there are more than one field of the text type, press enter to submit, and the webserver buttonx_click can be intercepted. <br>
HTML form input: <br>
<Input type = "text" value = "HTML input" Disabled = "disabled">
<Asp: button id = "button1" text = "Submit" onclick = "button#click" runat = "server"/>
<Br>
<Asp: Label id = "label1" runat = "server"/>
</Form>
</Body>
</Html>

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.