mercredi 12 octobre 2016

Why is my controller action filter no longer invoked once I override SSL settings with a "location" element?

I have an ASP.NET MVC3 application with an action filter attribute applied to a controller:

public class MyFilterAttribute : ActionFilterAttribute
    public override void OnActionExecuting(
        ActionExecutingContext filterContext)
            "MyFilterAttribute", "entered" );

    public override void OnResultExecuted(
        ResultExecutedContext filterContext)
             "MyFilterAttribute", "exited" );

public class MyController : Controller
    public ActionResult MyAction()
        return new EmptyResult();

MVC routing maps /MyPath/MyAction to the controller-action pair above.

and the client code invokes and dumps the response headers.

Initially it works - I see that the response received on the client contains two MyFilterAttribute headers as expected.

Then I add a location element to web.config:

  // lots of stuff, then
  <location path="MyPath">
         <access sslFlags="SslNegotiateCert"/>

and once I redeploy with these changes the response headers no longer contain the two MyFilterAttribute items.

Adding location to web.config is the only change. Once I remove it the old expected behavior is back.

It looks like adding a location elements somehow breaks MVC attributes.

What might be causing this behavior?

Aucun commentaire:

Enregistrer un commentaire