[Notes -- Basic ASP. NET knowledge (1 )]

Source: Internet
Author: User

Preface:
After several days of interviews, I found that, for students who have not yet graduated, the amount of project experience they have is not the most important to the company. The enterprise is more interested in the mastery of basic knowledge, now I will summarize the basic knowledge in this area and take the study notes!

  1. Differences between website and webapplication
    1) when the background code is changed, webapplication needs to restart the browser or regenerate the solution, while website does not;
    2) The website has no solution and no namespace, which is not conducive to engineering development.
  2. How does HTTP work?
    1) The client submits a form request to process the request.
    2) handle with the server-side Handler
    3) Server Response
    Note: The name attribute must be added to the form elements submitted to the server, because the server only recognizes the name, which is different from jquery and Dom. They only recognize the ID.
  3. Question about the method attribute of form specifying the form submission Method *
    1) Get (default value) is to explicitly pass the form through the URL in the address bar;
    The form value passed by post is hidden in the HTTP message and invisible in the URL address bar;
    2) The number of get passed values is limited and will be affected by the length of the address bar. It seems that the maximum value is 2 K bytes, and there is no limit on post.
    3) When you refresh the page in post, a browser will prompt you to resubmit the form dialog box, but get will not.
  4. What content in Div is not submitted to the server?
    The value of the name attribute (such as input, textarea, and select) of the DIV is submitted to the server.
  5. Viewstate Principle
    1) hide some fields to store controls without value attribute values
    2) because HTTP is a stateless protocol, when the page changes, viewstate will be used to maintain the last page state.
    3) For example, the label control is rendered by the browser as a <span> flag, so the label value exists in viewstate;
    Similarly, the Textbox Control is rendered by the browser as the input tag, and the values in the textbox do not need to be stored. Because textbox is essentially the input, the input will be submitted to the server without hiding the field.
    4) You can use the viewstatedecoder tool to view the appearance of the content in viewstate.
  6. Advantages and disadvantages of storing status information in hidden fields (viewstate)
    1) increase website traffic
    2) reduced access speed
    3) security issues (such as online banking) such as data spoofing may occur when confidential data is put into the form ). *
  7. All background programs implement the ihttphandler interface.
  8. Both cookie and session are used to store the data of the current client,
    Cookies are stored on the client, and sessions are stored on the server.
    Note: The session cannot store too much data. It stores object-type data, so you need to replace the data type during use.
  9. Each type of elements on the page, such as IMG, JS, and CSS, are requested separately when an HTTP request is sent. This can be viewed through the developer tool or the well-known firebug.
    * Http is a "stateless" protocol, so it does not remember what it did last time, nor does it remember the last message sent to the browser. So when it re-Requests next time, IMG, JS, CSS, and other files will re-send header information.
  10. Get is transmitted explicitly through parameters transmitted in the URL address bar, such :? A = 123 & B = ABC
  11. Post does not pass values through URLs, But it quietly transmits data in the background and uses _ viewstate for implicit transmission.
  12. Meaning of various HTTP Status Codes
    1) 200 series, indicating that the request is successful, OK
    2) series 300, such as 307, indicates server redirection and further processing of requests is required;
    3) Series 400, such as 404, indicates that the page is not found, file not found.
    4) 500 series, indicating an internal server error.
  13. The event submitted by the write delete button in the background is to be added to the onclientclick attribute in the button control.
    <Input type = "Submit" name = "delete" value = "delete" onclientclick = "Return confirm ('Are you sure you want to delete it? ') "/>
    A friendly operator can be prompted on the client to avoid unnecessary deletion.
  14. 127.0.0.0 is the loopback address, indicating that the local host cannot be accessed without passing through the nic and its alias is localhost.
    0.0.0.0 indicates any IP address, anyip.
  15. Convert HTML and js to a common one-to-one character
    Httputility. htmlencoder (string s) // convert to a special character. For example, convert <to <greater than sign>;
  16. /Indicates the root directory of the website;
    .. Indicates the parent directory;
    . Indicates the current directory;
    ~ The special path, which is only used in the server control, indicates that it is defined from the root directory of the application.
  17. Converts a virtual path to a full path, an absolute path
    Virtualpathutility, toablolute ("~ /A/B .html "); // convert to/website/A/B .html
  18. The server control must use the POST method to submit the form.
  19. You can use clientid to obtain the client Control ID,
    Getelementbyid ('<% = textbox1.clientid %> ');
    Not the ID of each server control is the same as that of the client control. For example, in a custom control (webusercontrl. ascx), the ID of the server control is different from that of the client.
  20. The label of the server control is rendered to <span> on the client side. If the associatecontrolid attribute is set to textbox1, it is rendered to <label for = "textbox1 "... /> to achieve the focus of the associated control.
  21. The literal control does not render anything on the client and is displayed in plain text.
    When the mode attribute is set to encode, the control automatically implements httputility. htmlencoder (string s) conversion, which is sometimes convenient and can avoid xxs attacks.
  22. Textbox Control
    1) when the textmode attribute is set to singleline, it is rendered as <input type = "text"/>
    2) When the textmode attribute is set to multiline, it is rendered as <textarea/>
    3) when the textmode attribute is set to pasword, it is rendered as <input type = "password"/>
    4) when the autopostback attribute is set to true, leaving the textbox with the user focus will result in a page post. It is best to use the _ dopostback js method when submitting a form.

    Written below: although the knowledge is basic, it is practical. Do not envy others for the cool JS effect. Three-day fishing and two-day surfing are not advisable. You must stick to your learning. No one has a high IQ and you don't have to learn it. The spirit of yugong's migration to mountains and kuafang's pursuit of Sun is worth learning!

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.