MVC中URL传多个参数

1.mvc中url传递多个参数不能直接使用&,会报错(从客户端(&)中检测到有潜在危险的 Request.Path 值

方法①:使用?---/Home/Index/?id=xxx&name=xxx(js:"/MsgTypeTem/Edit/?id=" + temId + "&flag=" + Math.random())

方法②:修改路由规则---

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.MapRoute(
                "Default", // 路由名称
                "{controller}/{action}/{uid}_{token}_{others}.html", // 带有参数的 URL
                new { controller = "Home", action = "Index", uid = UrlParameter.Optional, token = UrlParameter.Optional,others = UrlParameter.Optional} // 参数默认值
            );
posted @ 2015-01-17 21:35  琅琊天  阅读(885)  评论(0编辑  收藏  举报