首页 > Web开发 > 详细

ASP.NET MVC 伪静态的实现

时间:2014-06-21 10:34:58      阅读:419      评论:0      收藏:0      [点我收藏+]
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都走应用程序管道了,不知道怎么处理?

ASP.NET MVC 伪静态的实现,布布扣,bubuko.com

ASP.NET MVC 伪静态的实现

原文:http://www.cnblogs.com/yxlblogs/p/3795045.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!