Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Created Issue: Provide a way to replace the default HttpControllerDispatcher globally when hosted under ASP.NET [574]

$
0
0
Assume that I have the following custom HttpControllerDispatcher implementation:

public class MyCustomDispatcher : HttpControllerDispatcher {

protected override Task<HttpResponseMessage> SendAsync(
HttpRequestMessage request,
CancellationToken cancellationToken) {

// Do you stuff here

// According to your requirements, either run its default funtionality
// or return your own stuff
return base.SendAsync(request, cancellationToken);
}
}

And I want to register this globally. I thought that the best way would be to replace the GlobalConfiguration.DefaultHandler but it turns out that that property is read-only. so, the below solution is not applicable.

protected void Application_Start(object sender, EventArgs e) {

GlobalConfiguration.DefaultHandler = new HttpRoutingDispatcher(
GlobalConfiguration.Configuration, new MyCustomDispatcher());

}

It's easy to do it per-route by attaching the handler but I wasn't able to find a way to do it globally.

This issue is also discussed under http://aspnetwebstack.codeplex.com/discussions/400366.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>