I can't create a custom ValidationAttribute in asp.net 3.5 webservice. Everything seems ok, it compiles and it runs, it just doesn't enter the custom attribute i created. Msdn documentation (http://msdn.microsoft.com/en-us/library/cc668224(v=vs.90).aspx) states that I have to override the IsValid method to get it validated, still it doesn't enter the IsValid. I guess there's a configuration problem and i can't see any other flaw in the code atm.
So, here's the webservice code
[WebMethod]
[Authorize("me")]
public string test()
{
return "Here I am";
}
and this is the ValidationAttribute
public class AuthorizeAttribute : ValidationAttribute { public string me { get; private set; } public AuthorizeAttribute(string me) { if (string.IsNullOrEmpty(me)) { throw new ArgumentNullException("Not me!"); }
this.me = me;
}
public override bool IsValid(object value)
{
bool result = false;
return result;
}
}
I would say that before the webmethod executes it goes into the Constructor(at least that!) and then into the IsValid method, but it doesn't.
Can you say where's the error?
Thanks
/Sball
Aaaaand seems i cannot format this question properly. Sorry