Skip to content

Instantly share code, notes, and snippets.

@ashour
Last active April 23, 2020 12:36
Show Gist options
  • Save ashour/002d642751fa38911d408e0c6798ddc9 to your computer and use it in GitHub Desktop.
Save ashour/002d642751fa38911d408e0c6798ddc9 to your computer and use it in GitHub Desktop.
using System.Web.Mvc;
using System.Web.Routing;
namespace I18nDemo
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Root",
url: "",
defaults: new {
controller = "Base",
action = "RedirectToLocalized" }
);
routes.MapRoute(
name: "Default",
url: "{culture}/{controller}/{action}/{id}",
defaults: new {
culture = "en",
controller = "Home",
action = "Index",
id = UrlParameter.Optional },
constraints: new { culture = "en|ar" }
);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment