A brief discussion on the usage of request and response in ASP _ Application skills

Source: Internet
Author: User

Usage of request:

The request has three methods for obtaining form values, which are used for the acquisition of different form submission methods respectively. A form can simply be thought of as a collection of parameters to be passed by a page, and the method submitted has two post and get. In these two methods, corresponding to the different receiving methods, its specific implementation is as follows:

1. For the method of obtaining value of the form submitted by the Post method, obtain the desired field identification by using the Get method of the form property of request. For example, the code that gets the value of the txtUserName in the submit form is placed in the string Usrname as follows, string Username=request.form.get ("txtUserName"). ToString ();

2, for the Get method of the form submitted by the value of the method, using the QueryString attribute of the request of the field identification to obtain the value. For example, the code that gets the txtUserName value in the Submit form is placed in the string Usrname as follows, string username=request.querystring["txtUserName". ToString ();

3, for both methods are applicable methods, using the index value of request to get the value of the form, the code is as follows,

String username=request["txtUserName"]. ToString ();

Among them, their advantages and disadvantages are as follows:

1. This method is a method of receiving a value for the form submitted by the Post method, and the parameter values passed by the method of post pass values are not displayed in clear text in the URL.
2, this method is a get method submitted to the form to obtain the value of the method, for the use of Get-pass method Disadvantages:
(1), plaintext display,
(2), the length is limited;

Advantages: (1), can directly define a URL can be transmitted value;
Role: (1), used to do the news when the template is convenient

the method of response

The most important approach here is Response.Write (string) and Response.Redirect (URL). The role of
Response.Write (string) to return data (write data)
Response.redirec ("url") from the server side to the client is directed to another page in the server side.

Related Article

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.