我有下一个特定的地图路线
routes.MapRoute(
"MyPagePost",
"URL-Up/{name}",
new { controller = "MyController", action = "MyPostAction" },
new { httpMethod = new HttpMethodConstraint("POST") }
);
routes.MapRoute(
"MyPageGet",
"URL-Up/{name}",
new { controller = "MyController", action = "MyGetAction" },
new { name = "[A-Za-z].+", httpMethod = new HttpMethodConstraint("GET") }
);
我的默认控制器看起来像
routes.MapRoute(
name: "Default",
url: "{culture}/{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", culture = "en", id = UrlParameter.Optional },
constraints: new { culture = @"[a-zA-Z]{2}" }
);
HTML中的FORM看起来像
<form action="/URL-Up/Bla-Bla" id="myid" method="post" novalidate="novalidate">
</form>
问题接下来是:
在Chrome或fiddler日志中,我看到对URL-Up/Bla-Bla
的重新获取有302状态,响应标头重定向到 URL-Up / Bla-Bla?culture = de 。为什么不能处理?
答案 0 :(得分:0)
以不同的方式我终于顿悟解决问题我用httppost属性编写相同的控制器方法名称MyGetAction并且它正在工作