vendredi 20 mars 2015

Can I Get An Action's Url Through Reflecting the DLL of a .Net MVC Website?

As the title.


So far I could get all controllers and actions info, like this


```



var sb = new StringBuilder();
var asb = Assembly.LoadFrom(dllPath);
var ctrlDescs = from ctrl in asb.GetTypes()
where ctrl.BaseType != null && ctrl.BaseType.Name == "Controller"
select new ReflectedControllerDescriptor(ctrl);
foreach(var ctrlDesc in ctrlDescs)
{
var actionDescs = desc.GetCononicalActions();
//get actionName or something else...
}


```


But how can I build the url of an action? Should I implement a url parser myself to parse it? If so, where should I get the info such like "Area" of an controller?


Thanks






Aucun commentaire:

Enregistrer un commentaire