* The most common way of interacting, within the action method in Contoller
Public ActionResult Index ()
{
viewdata["Key"] =value;
Return View ();
}
* The front page of the action, in the foreground of the index.aspx, you can use <%=viewdata["Key"]%>
* The method that executes this action is the first to be executed whenever an action is requested.
* In action, you can return a page that uses a different action to the user, such as:
Public ActionResult Index (0
{
viewdata["Key"] = value;
Return View ("Index2");//If the argument is empty, then the index is found by default
}
* In action, you can return Content ("OK") in addition to return View (); , then it is equivalent to Response.Write ("OK"); Respone.end ();
When you use return Content (JSON), it is equivalent to a generic handler, which is not necessarily the output view in the action anyway.
* In action, the public ActionResult myaction (string id,string Pwd) can be used in addition to the non-parametric action method;
The formal parameter names here must be identical to the parameter names submitted by the form, which is matched when IIS runs the page life cycle by reflecting the Controller's action method.
* In action, in addition to the above parameters, you can also encapsulate id,pwd in a custom User class, the property name must be consistent with the form parameter name, such as public actionresult myaction (user user);
public class User
{
public string Id{get;set;}
Pulic string Pwd{get;set;}
}
Learning notes 24_MVC data interaction before and after