asp.net MVC3 从客户端(&)中检测到有潜在危险的 Request.Path 值。


A链接(url:http://localhost:56482/Sys/questionEdit/15&firstEdit=yes)打开,发生错误,提示“从客户端(&)中检测到有潜在危险的 Request.Path 值。”


解决办法:

步骤1、在Global文件中创建一个自定议路由。

            routes.MapRoute(
                "Sys", // 路由名称
                "{controller}/{action}/{id}/{firstEdit}", // 带有参数的 URL
                new { controller = "Sys", action = "questionEdit" }, // 参数默认值
                new { firstEdit = "[a-z0-9]+", id = @"\d+" }
                );
步骤2、A链接的url改为http://localhost:56482/Sys/questionEdit/15/yes。

问题就解决了。

猜你喜欢

转载自blog.csdn.net/gditzmr/article/details/43763565
今日推荐