码迷,mamicode.com
首页 > Web开发 > 详细

MVC中URL传多个参数

时间:2015-01-17 22:06:24      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:

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} // 参数默认值
            );

MVC中URL传多个参数

标签:

原文地址:http://www.cnblogs.com/wanshi1989/p/4231084.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!