How do I get the Controller and Action names from the Referrer Uri?

前端 未结 9 1027
清歌不尽
清歌不尽 2020-12-01 14:06

There\'s a lot of information for building Uris from Controller and Action names, but how can I do this the other way around?

Basically, all I\'m trying to achieve i

9条回答
  •  北海茫月
    2020-12-01 14:35

    The RouteData object can access this info:

     var controller = RouteData.Values["controller"].ToString();
     var action = RouteData.Values["action"].ToString();
    

提交回复
热议问题