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) 
If you can't read this number refresh your screen
Enter the numbers above:  

Search

This Blog

Tags

Community

Archives

Syndication

Email Notifications

News




  • View Luis Abreu's profile on LinkedIn


    Follow me at Twitter

    My books

    Portuguese LINQ book cover

    Portuguese ASP.NET 3.5 book cover

    Portuguese ASP.NET AJAX book cover

    Portuguese ASP.NET AJAX book cover