Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMandeep Singh
895 PointsUnable to complete this challenge.
I tried using Redirect method, but I'm getting error as "The type or namespace name `Redirect' could not be found. Are you missing an assembly reference?".
using System.Web.Mvc;
using System;
namespace Treehouse.Controllers
{
public class VideoGamesController : Controller
{
public ActionResult Detail()
{
return new Redirect("/");
}
}
}
1 Answer
Edward Ries
7,388 PointsRemove the "new" from your return Redirect. You don't need to instantiate an object.
Mandeep Singh
895 PointsMandeep Singh
895 PointsHi Edward, I tried your suggestion but I got Error "The name `Redirect' does not exist in the current context".
Edward Ries
7,388 PointsEdward Ries
7,388 PointsThe challenge simulator apparently doesn't support the Redirect using the Challenge Link at the top of the page. I'm fairly sure that the code you have above will work fine in an Mvc application after you remove the "new" before Redirect. If you have a specific challenge that's not working please directly me and I'll see what I can figure out.