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

Created Unassigned: RouteData not available to WebHost's buffer policy selector for attribute routing generated routes [1158]

$
0
0
__Scenario__:
User wishes to upload large files to a Web API service. He does not want these files to be buffered, so depending on the incoming request's route data (ex: controller, action), he either enables streamed or buffer mode.

__Issue__:
In the below code, "UserBufferInputStream" method isn't having any routedata available to perform the evaluation. This happens only for attribute routing generated routes as it goes through a certain path which conventional routes do not go through.

```
config.Services.Replace(typeof(IHostBufferPolicySelector), new CustomWebHostBufferPolicySelector());

public class CustomWebHostBufferPolicySelector : WebHostBufferPolicySelector
{
public override bool UseBufferedInputStream(object hostContext)
{
HttpContextBase contextBase = (HttpContextBase)hostContext;

RouteData routeData = contextBase.Request.RequestContext.RouteData;

object actions;
if (routeData.DataTokens != null && routeData.DataTokens.TryGetValue("actions", out actions))
{
//retrieve the controller name from action descriptors
}

return true;
}
}

```

Viewing all articles
Browse latest Browse all 7215

Trending Articles



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