Get request data in custom attribute

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?

If it’s on the requestDto just cast it? I can’t tell what the Type is from the screenshot, but if you know the type just cast it:

var baseDto = requestDto as MyBase;
if (baseDto != null) {
    var cap = baseDto.AN07_CAP;
}

You can convert it to an object dictionary and access it by key, e.g:

var map = requestDto.ToObjectDictionary();
object value;
if (map.TryGetValue("AN07_CAP", out value) {
    var cap = (string)value;
}

Or you should be able to use dynamic:

dynamic dto = requestDto;
string cap = dto.AN07_CAP;