zoukankan      html  css  js  c++  java
  • Mixing ASP.NET and MVC routing

    Here is the solution I settled on. I installed the NuGet Microsoft.AspNet.FriendlyUrls package. Then I named the .aspx page with a page name that would look good without the extension. Then I set up the routing as follows:

    
        public static void RegisterRoutes(RouteCollection routes)
        {
            FriendlyUrlSettings aspxSettings = new FriendlyUrlSettings();
            aspxSettings.AutoRedirectMode = RedirectMode.Off;  // default=Off
            routes.EnableFriendlyUrls(aspxSettings);
    
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 
            );
    
            routes.MapPageRoute("Design-Fancy", "Design/Fancy/{*queryvalues}", "~/Design/Fancy.aspx", true);
            routes.MapPageRoute("Design-Simple", "Design/Simple/{*queryvalues}", "~/Design/Simple.aspx", true);
        } 
  • 相关阅读:
    vue(5)
    vue(4)
    vue(3)-防止闪烁
    vue(2)
    bootstrap 模态框
    2017年上半年工作总结和计划
    vue(1)
    文本框数量加减功能
    meta 控制移动端页面的缩放
    题解 P1550 【[USACO08OCT]打井Watering Hole】
  • 原文地址:https://www.cnblogs.com/shiningrise/p/5738707.html
Copyright © 2011-2022 走看看