I am trying to create a ValidationAttribute (for checking Remote, which only works on the server side) and inside the IsValid method, I need to resolve the URL from the route values โโof the URL. Here is my initial setup:
public class ServerSideRemoteAttribute : ValidationAttribute { public string Controller { get; set; } public string Action { get; set; } public object RouteValues { get; set; } public ServerSideRemoteAttribute(string controller, string action) { this.Controller = controller; this.Action = action; } public ServerSideRemoteAttribute(string controller, string action, object routeValues) { this.Controller = controller; this.Action = action; this.RouteValues = routeValues; } protected override ValidationResult IsValid(object value, ValidationContext validationContext) {
Any thoughts?
source share