Controller.View Method (Object)

Creates a ViewResult object by using the model that renders a view to the response.

Namespace:  System.Web.Mvc
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)


Protected Friend Function View ( _
    model As Object _
) As ViewResult
Dim model As Object
Dim returnValue As ViewResult

returnValue = Me.View(model)
protected internal ViewResult View(
    Object model
protected public:
ViewResult^ View(
    Object^ model
 function View(
    model : Object
) : ViewResult


  • model
    Type: System.Object
    The model that is rendered by the view.

Return Value

Type: System.Web.Mvc.ViewResult
The view result.


This overload of the View method returns a ViewResult object that has an empty ViewName property. If you are writing unit tests for controller actions, take into account the empty ViewName property for unit tests that do not take a string view name.

If the ViewName property is empty, the current action name is used in place of the ViewName property.

The result object that is prepared by this method is written to the response by the ASP.NET MVC framework when the object is executed.

See Also


Controller Class

View Overload

System.Web.Mvc Namespace