title: How can I get controller type and action info from a url or from route data?
body: <p>How can I get the controller action (method) and controller type that will be called, given the <code>System.Web.Routing.RouteData</code>?</p>
  
  <p>My scenario is this - I want to be able to do perform certain actions (or not) in the <code>OnActionExecuting</code> method for an action.</p>
  
  <p>However, I will often want to know not the current action, but the "root" action being called; by this I mean I may have a view called "Login", which is my login page. This view may include
  another partial view "LeftNav". When <code>OnActionExecuting</code> is called for LeftNav, I want to be able to determine that it is really being called for the "root" aciton of Login.</p>
  
  <p>I realise that by calling <code>RouteTable.Routes.GetRouteData(actionExecutingContext.HttpContext)</code>, I can get the route for the "root" request, but how to turn this into
  method and type info?</p>
  
  <p>The only solution I have so far, is something like:</p>
  
  <pre><code> var routeData = RouteTable.Routes.GetRouteData(actionExecutingContext.HttpContext)
   var routeController = (string)routeData.Values["controller"]; 
   var routeAction = (string)routeData.Values["action"];
  </code></pre>
  
  <p>The problem with this is that "routeController" is the controller name with the "Controller" suffix removed, and is not fully qualified; ie it is "Login", rather than "MyCode.Website.LoginController".</p>
  
  <p>I would far rather get an actual <code>Type</code> and <code>MethodInfo</code> if possible, or at least a fully qualified type name.</p>
  
  <p>Any thoughts, or alternative approaches?</p>
  
  <p>[<strong>EDIT</strong> - this is ASP.Net MVC 1.0]</p>