开发者

ASP.NET MVC RemoteAttribute: No url for remote validation could be found

How to configure RemoveAttribute to work with routes like this one?

 context.MapExtendedRoute("ValidateSomething",
                                 "some-where/validate/{propName}",
                                 new { Controller = "SomeWhere", Action = "ValidateSomeRouteKey开发者_JAVA技巧" });

When I pass above route name to RemoteAttribute constructor, an InvalidOperationException occurs. But works just like a charm when there is no propName in route definitions and parameter passed as querystring.

Thanks in advance;)


You need to add the {propname} parameter to your route, so that you can access it in your controller. In the example below I have made it optional.

context.MapExtendedRoute("ValidateSomething",
                             "some-where/validate/{propName}",
                             new { Controller = "SomeWhere", Action = "ValidateSomeRouteKey", propName = UrlParamter.Optional });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜