Exemple #1
0
        public static void RegisterRoutes(System.Web.Routing.RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            //routes.MapRoute(
            //    name: "SomeName1",
            //    url: "A/B",
            //    defaults: new { controller = "M", action = "N" },
            //    namespaces: new[] { "My_Web_Template.Controllers" }
            //);

            //routes.MapRoute(
            //    name: "SomeName2",
            //    url: "Page/{name}",
            //    defaults: new { controller = "Page", action = "Display", name = System.Web.Mvc.UrlParameter.Optional },
            //    namespaces: new[] { "My_Web_Template.Controllers" }
            //);

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = System.Web.Mvc.UrlParameter.Optional },
                namespaces: new[] { "My_Web_Template.Controllers" }
                );
        }
Exemple #2
0
 public static void RegisterRoutes(System.Web.Routing.RouteCollection routes)
 {
     routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
     routes.MapRoute(
         name: "Default",
         url: "{controller}/{action}/{id}",
         defaults: new { controller = "Home", action = "Index", id = System.Web.Mvc.UrlParameter.Optional }
         );
 }
Exemple #3
0
    /// <summary>
    /// Registers routes within <see cref="T:System.Web.Routing.RouteCollection"/> for the application.
    /// </summary>
    /// <param name="routes">The <see cref="T:System.Web.Routing.RouteCollection"/> from the <see cref="P:System.Web.Routing.RouteTable.Routes"/>.</param>
    public void Register(System.Web.Routing.RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            "Default",                                   // Route name
            "{controller}/{action}/{id}",                // URL with parameters
            new { controller = "Home", action = "Index", id = UrlParameter.Optional },
            new string[] { "MyNamespace.Controllers" }); // Parameter defaults
    }
Exemple #4
0
        public static void RegisterRoutes(System.Web.Routing.RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Login", action = "Index", id = System.Web.Mvc.UrlParameter.Optional },
                namespaces: new[] { "MY_MVC_APPLICATION.Controllers" }
                );
        }
 public static void RegisterRoutes(System.Web.Routing.RouteCollection routes)
 {
     routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
     string[] array = new string[1];
     array[0] = "WebMathsExpEvaluator";
     routes.MapRoute(
         name: "Default",
         url: "{controller}/{action}/{id}",
         defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
         namespaces: array);
 }
        public static void RegisterRoutes(System.Web.Routing.RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            // ترتيب نوشتن اهميت دارد
            // و بايد دستورات استثناء ذيل، قبل از دستور پيش فرض اصلی نوشته شوند

            routes.MapRoute(
                name: "SomeName1",
                url: "A/B",
                defaults: new { controller = "M", action = "N" },
                namespaces: new[] { "LEARNING_AREA.Controllers" }
                );



            routes.MapRoute(
                name: "SomeName2",
                url: "Page/{name}",
                defaults: new { controller = "Page", action = "Display", name = System.Web.Mvc.UrlParameter.Optional },
                namespaces: new[] { "LEARNING_AREA.Controllers" }
                );

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

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = System.Web.Mvc.UrlParameter.Optional },
                namespaces: new[] { "LEARNING_AREA.Controllers" }
                );
        }