Asp.net mvc asp.net mvc获取路由对应的url

Asp.net mvc asp.net mvc获取路由对应的url,asp.net-mvc,url,routes,Asp.net Mvc,Url,Routes,我面临以下问题。我有一个url,我想检查url是否可以映射到我的RouteConfig中定义的任何路由。换句话说,我需要一种正确的方法来确定url是否适合我的应用程序 也许有人知道怎么做?例如:学生是我的控制者,有动作方法学生列表,然后我需要在RouteConfig.cs文件中编写以下代码。 For Example : Student is my contoller and having action method StudentList then I need to write fol

我面临以下问题。我有一个url,我想检查url是否可以映射到我的RouteConfig中定义的任何路由。换句话说,我需要一种正确的方法来确定url是否适合我的应用程序

也许有人知道怎么做?

例如:学生是我的控制者,有动作方法学生列表,然后我需要在RouteConfig.cs文件中编写以下代码。
For Example : Student is my contoller and having action method     StudentList then I need to write following code in RouteConfig.cs file.

StudentContoller.cs

        public List<Student> StudentList (StudentModel model)
        {
            /* Logic for Student List */
         return View(model);
        }


      RouteConfig.cs

     routes.MapRoute(
                name: "StudentList",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Student", action ="StudentList", id = UrlParameter.Optional }
     );
StudentContoller.cs 公共列表学生列表(学生模型) { /*学生名单逻辑*/ 返回视图(模型); } RouteConfig.cs routes.MapRoute( 姓名:“学生名单”, url:“{controller}/{action}/{id}”, 默认值:新建{controller=“Student”,action=“StudentList”,id=urlparmeter.Optional} );