I'm trying to create a route that redirects to urls but can't get it to work for the life of me. Here's what I have so far:
public class GoAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "Go";
}
}
public override void RegisterArea( AreaRegistrationContext context )
{
context.MapRoute(
"Go/Issues",
"go/issues/{issueID}",
new { controller = "Go", action = "GoIssues" },
new { issueID = @"\d+" }
);
}
}
and my controller:
public class GoController : Controller
{
public ActionResult GoIssues( int issueID )
{
var version = getVersion( issueID );
if( version != null )
{
string url = MakeUrl(version, issueID);
// Redirect to the right url
return Redirect( url );
}
}
// not found
return HttpNotFound();
}
}
The whole point of this is to determine the right version to redirect to and to redirect there. But for some reason go/issues/123 gives me a 404 not found. I used the route debug tool and it shows that this route is hit but when I disable it, I'm back to 404.
Any help is greatly appreciated.
Thanks