Mvc–6.controller action method parameter and return value

Source: Internet
Author: User

6.1 Controller receives browser data

A. Get the Get data:

A1: Gets the set parameters that are configured in the routing URL:

such as a configured route:

The browser request path is:/USER/MODIFY/1, after the MVC framework obtains the request, will find the matching route map path URL, know is the request controller class User's Modify method, at this time will check whether this method contains a parameter named ID, if there is, Get the "parameter" {ID} by the configured URL and pass it to this method.

A2. Get the URL by requesting the request from the context object directly:

The browser request path is:/USER/USERLIST/1?FUN=JP

Controller acquisition: request.querystring["Fun"];

B. Get Post data

B1. Get the data submitted by the form by request.form["name"]

B2. Get the data submitted by the form individually by FormCollection form

B3. Get the data for a FORM element one time through the entity Object model and set it to the property of the Entity object

The property name of the form element in the form must be the same as the property of the entity Object!

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.