Still on getting info about the current Route

Published Thu, Jul 24 2008 12:25

In one of my previous posts, I’ve showed how you could access the Values property of the RouteData class to get info about the current controller and action. What I forgot to mention at the time was that you should use the GetRequiredString method to get the url parameter values that must be filled when you request a specific route. That means that I should have written the following code:

var controllerName = route.GetRequiredString( "controller" );
var actionName = route.GetRequiredString( "action" );

instead of the code that I presented on that post.
Filed under: ,

Leave a Comment

(required) 
(required) 
(optional)
(required)