Controller.View Method (String)
Creates a ViewResult object by using the view name that renders a view.
Namespace: System.Web.Mvc
Assembly: System.Web.Mvc (in System.Web.Mvc.dll)
Parameters
- viewName
- Type: System.String
The name of the view that is rendered to the response.
The following example shows how to return a view from an action method. Both action methods return the TestJson.aspx page from the Views subfolder that matches the controller name. The TestJson method defaults to returning the TestJson.aspx page. The TestJsonContent method explicitly returns the TestJson.aspx page.
Show: