Generally, the request data includes form data, query string parameter values, and cookies.
Like ASP. NET, you can still use the Request attribute to obtain the Request data.
The Controller has a Request attribute and a Request attribute in the view page, which can be used to obtain Request data.
You can use Request. Form to obtain the specified Form data, as shown in the following code:
String userName = this. Request. Form ["UserName"];
String password = this. Request. Form ["Password"];
You can use Request. QueryString to obtain the specified query string parameter value, as shown in the following code:
String Country = this. Request. QueryString ["Country"];
You can use Request. Cookies to obtain the specified Cookie value. The following code:
String UserName = this. Request. Cookies ["UserName"]. Value;
Except for the Request. Form data listed above,
Request. QueryString get the query parameter value,
In addition to the Cookie value obtained by Request. Cookies,
You can also use the fuzzy query Request to query the Request data.
For example, the following code:
String userName = this. Request ["UserName"];
String password = this. Request ["Password"];
This is the UserName and Password,
It may be form data, query parameter values, or Cookie values.
Although this method causes us to enter less code, it may cause some performance loss.
Therefore, if we know exactly which data in the form data, query parameter value, and Cookie is to be obtained,
Use the corresponding set attribute to obtain it!
To learn more, you can watch the Demo Video.