Hi, I’m writing a simple custom attribute to read the data from my client request…
Here is the code:
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public class MyTestAttribute : MyTestAttribute
{
public MyTestAttribute(ApplyTo applyTo)
{
ApplyTo = applyTo;
Priority = -77;
}
public MyTestAttribute() : this(ApplyTo.All) {}
public override void Execute(IRequest req, IResponse res, object requestDto)
{
if (req.Verb == "POST" || req.Verb == "PUT" || req.Verb == "DELETE")
{
var cap = req.GetParam("AN07_CAP");
}
}
}
I think I’m wrong reading the value that way because I always get a null
value…
If I put a breakpoint in my code I can clearly see the correct value coming from the client request:
How can I get that value?