using Microsoft.AspNet.FriendlyUrls;
using System.Web.Mvc;
using System.Web.Routing;

namespace NKC_WF
{
    public static class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            var settings = new FriendlyUrlSettings();
            settings.AutoRedirectMode = RedirectMode.Permanent;
            routes.EnableFriendlyUrls(settings);

            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            // route default URL to index.aspx
            routes.MapPageRoute(
                routeName: "DefaultToHTML",
                routeUrl: "",
                physicalFile: "~/Default.aspx",
                checkPhysicalUrlAccess: false,
                defaults: new RouteValueDictionary(),
                constraints: new RouteValueDictionary { { "placeholder", "" } }
            );

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Browser", action = "Index", id = UrlParameter.Optional }
            );
        }
    }
}
