[英]Redirection with routes in ASP.NET MVC 4
I am creating a redirection for an app written with .Net Framework 4.5. 我正在为使用.Net Framework 4.5编写的应用程序创建重定向。
In the RouteConfig file i create a new routes.MapRoute()
and it works. 在RouteConfig文件中,我创建了一个新的route.MapRoute
routes.MapRoute()
并且它可以工作。 It shows the Controller and action that I want. 它显示了我想要的控制器和动作。
But I dont want to mantain the user the url and use the app from there. 但我不想保留用户的网址并从那里使用应用程序。 I just want that when the user write /Something it redirects to /AnotherSomething, not to use the app in /Something.
我只希望在用户编写/ Something时将其重定向到/ AnotherSomething,而不是在/ Something中使用该应用程序。
How should I do? 我应该怎么做?
如果正确了解您:
routes.RouteMap("RedirectExample", "Something", new { controller : "MyController", action : "AnotherSomething"});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.