在请求虚拟网址时如何重定向到真实网址:
示例:
virtual URL : {language}/{action} >> English/Index
real URL : {language}/{controller}/{action} >> English/Home/Index
我尝试了这个,但没有给出我想要的东西:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{language}/{controller}/{action}",
defaults: new { lang="ar", controller = "Homes", action = "Index"}
);
}