zoukankan      html  css  js  c++  java
  • ASP.NET MVC 伪静态的实现

    public class RouteConfig
        {
            public static void RegisterRoutes(RouteCollection routes)
            {
                routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
    
                routes.MapRoute("Category",
                           "list/{filterAttr}-{cateId}-{brandId}-{sortColumn}-{page}.html",
                           new { controller = "Home", action = "Index", id = UrlParameter.Optional });
    
                routes.MapRoute(
                    name: "Default",
                    url: "{controller}/{action}/{id}",
                    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
                );
            }
        }
    public class SearchModel
        {
            public int BrandId { set; get; }
            public int FilterAttr { get; set; }
            public int CateId { get; set; }
            public int SortColumn { get; set; }
            public int Page { get; set; }
        }
    public ActionResult Index( SearchModel model )
            {
                return View(model);
            }
    @{
        ViewBag.Title = "Index";
    }
    @model MvcApplication3.Models.SearchModel
    <h2>Index</h2>
    @Html.RouteLink("aa","Category") 
    FilterAttr:@Model.FilterAttr<br />
    CateId:@Model.CateId<br />
    BrandId:@Model.BrandId<br />
    SortColumn:@Model.SortColumn<br />
    Page:@Model.Page<br />

    最后记得Web.config配置:

     <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"></modules>

    这个配置了之后就意味着html都走应用程序管道了,不知道怎么处理?

  • 相关阅读:
    linux磁盘管理
    yarn一直在跑一个用户为dr.who的application
    HBASE强制删除表
    Centos安装git2.2.1
    MySQL类型float double decimal的区别
    PHP的extension_dir设置问题
    opencart安装和使用PHPMailer
    在路上
    修改win10中linux子系统的root密码
    关于js for循环click事件
  • 原文地址:https://www.cnblogs.com/yxlblogs/p/3795045.html
Copyright © 2011-2022 走看看