vendredi 14 août 2015

Get all site relative Urls from Route table on Application_Start

Within an MVC5 app we have introduced a security model which will authorise the user logged in against the requested Url. I have been looking at ways to auto generate a list of available Urls within the application on start up.

I first entertained the idea of using reflection to build up relative Urls from the area/controller/action names similar to this post

This will work if all the urls match the standard convention within MVC however; we have some routes that do not match this convention so an auto scan using reflection will not cover all grouds.

Is there a way (on application_start event) I can possibly use the route table to determine what Urls are available?

Note:

I understand the Http Context is not yet available at this point but I do not need the whole Url, only the relative url after the domain.





Aucun commentaire:

Enregistrer un commentaire