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

Edited 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:<br /><br /> public class MyCustomDispatcher : HttpControllerDispatcher {<br /><br /> protected override Task<HttpResponseMessage> SendAsync(<br /> HttpRequestMessage request, <br /> CancellationToken cancellationToken) {<br /> <br /> // Do your stuff here<br /><br /> // According to your requirements, either run its default funtionality <br /> // or return your own stuff<br /> return base.SendAsync(request, cancellationToken);<br /> }<br /> }<br /><br />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.<br /><br />protected void Application_Start(object sender, EventArgs e) {<br /><br /> GlobalConfiguration.DefaultHandler = new HttpRoutingDispatcher(<br /> GlobalConfiguration.Configuration, new MyCustomDispatcher());<br /><br />}<br /><br />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.<br /><br />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>