Introduction
This article shows how to use view result in a Controller in MVC.
Step 1
Create a MVC project from the "Empty" template.
Right-click on "Controllers" and select "Add" >> "Controller...".
Step 2
Select "MVC 5 Controller - Empty" to add an empty Controller.
Click on the "Add" button.
Step 3
Name the Controller as in the following:
Step 4
Now we need to create a view.
Right-click on "Index" and select "Add View...".
Step 5
Name the view and select "Empty (without model)" as the template.
Click on the "Add" button.
Step 6
Add a title in the index page.
Step 7
ViewResult represents a class that is used to render a view by using an IView instance that is returned by an IViewEngine object. View() creates an object that renders a view to the response.
Step 8
Now we need to create a view.
Right-click on "About" and select "Add View...".
Step 9
Name the view and select "Empty (without model)" as the template.
Click on the "Add" button.
Step 10
Add the title in the about page.
Step 11
Add html.actionlink for about.cshtml.
Step 12
Run the project, click on the about link and you will see the about page rendered in the browser.

<< Day 10 >> Day 12
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment
It is the same account you read, post and publish with — and you will come straight back to this page.

Akshay PatelPosted Oct 30, 2014, 5:29 AM
ViewResult - Renders a view as an HTML document...RedirectResult - Redirects to another action method by using its URL and passing through the routing process....ActionResult is a base class of nine default action results...1. ContentResult 2. EmptyResult 3. FileResult 4. JavascriptResult 5. JsonResult 6. RedirectResult 7. ViewResult 8. RedirectToRouteResult 9. PartialViewResult
phuong LePosted Oct 28, 2014, 1:00 PM
Hi, Akshay Patel, What is diffrent between actionResult,RedirectResult, and View Result. I see it return 1 result "page about". Can you show me It diffrent here.Thanks.