1. Features
[Authorizefilter] for permission filtering
[HttpGet]
[HttpPost]
2. Parameters
Get method
public actionresult void Get (int id) {}
Submit
[HttpPost] Public void Post (model) { varnew Result (); if NULL ) return Json (result);}
Upload image
[HttpPost] Public void return"text/html", Encoding.UTF8);}
3. Return type (return method)
return NULL;//returns the emptyresult of a null or void data typereturnView ();//returns a view with the same name as this controllerreturnView (model);//returns a view with the same name as this controller, and passes the model to the viewreturnView ("Success");//returns the specified viewreturnView ("Success", model);//returns the specified view and passes the model to the viewreturnJson (result, jsonrequestbehavior.allowget);//typically submitted by a request to post or AJAX, return JSONreturnContent ("Test Content","text/html");//text type can be specifiedreturnJavaScript ("alter (' Hello ');");//script executed at the client, but does not respond directly to pop-up windows, requiring the page to be called againstringFileName ="~/content/test.zip";//file namestringDownfilename ="file display name. zip";//the file name to display in the download box//returns the binary output of the Fileresult to write to the response, which is generally used as a simple downloadreturnFile (FileName,"Application/octet-stream", Downfilename); // Redirect method: Redirect/redirecttoaction/RedirecttoroutereturnRedirect ("http://www.baidu.com");//go directly to the specified URL addressreturnRedirecttoaction ("Index","Home",New{id="1"});//jump to the specified controllerreturnRedirecttoroute ("Default",New{controller ="Home", action ="Index"});//specify a route to jump
Recommended articles:
Http://www.cnblogs.com/artech/archive/2012/08/13/action-result-01.html
MVC Controller Summary