This course will be retired on July 14, 2025.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
Returning a string literal from a controller action method is unusual. An action method typically returns one of the MVC action result types. Let’s see how to do that.
Follow Along
To follow along commiting your changes to this course, you'll need to fork the aspnet-comic-book-gallery repo. Then you can clone, commit, and push your changes to your fork like this:
git clone <your-fork>
cd aspnet-comic-book-gallery
git checkout tags/v2.4 -b using-action-result-types
Additional Learning
For more information on the .NET types used in this video, see these MSDN pages:
-
ActionResult class (from which both
ContentResult
andRedirectResult
derive) - DateTime Structure
This Stack Overflow question will show you how to disable the Diagnostic Tools in Visual Studio.
Keyboard Shortcuts
-
F12
- Go To Definition -
ALT+F12
- Peek Definition
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
DJ Scott
6,325 PointsI'm getting a "Cannot implicitly convert type 'System.Web.Mvc.ContentResult' to 'string'"
Posted by DJ ScottDJ Scott
6,325 Points1 Answer
-
Jolanda -
885 Points1 Answer
-
Simon Sporrong
35,097 Points1 Answer
-
Xiaolong Yang
4,374 PointsWhy not adding a semicolon after Content = "XXX"?
Posted by Xiaolong YangXiaolong Yang
4,374 Points2 Answers
-
Aaron Selonke
10,323 Points2 Answers
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up