ASP. NET MVC provides a variety of return methods, on the one hand, the view can be reused, on the other hand, flexible and powerful, have a direct return to the view, return JSON, return the file stream, return to the same controller action, return to another controller and so on.
1 The most common is to return directly to the view, so that you can directly return to the corresponding view folder under the same name as the action, and this view method, can take parameters, the diagram with the model parameters of the view, can be used as a display list
2 can also return Action,redirecttoaction () under the same controller, that is, the index method that returns the same controller directly; in fact, this method has other overloaded methods, such as the second parameter is the controller name, You can specify a different controller, two of which are equivalent in the second diagram
3 Another option is to return the specified URL, which is redirect (), which is actually equivalent to the three return methods.
4 in some special requirements, you can return the JSON, the diagram can be used to asynchronously determine whether the domain name already exists, if there is no return true, otherwise return false
5 finally introduces the return of a file stream, generally used for file download; The return value is Filepathresult and the file () method is called when returned
6 The Return of action is introduced here, I wish you a happy study!
I original, reproduced please indicate the source, better visual typesetting please: Http://t.cn/RPgNtoB
Walk into asp: [5]action's return