0

I have an ActionContext object.

I want to read the Range header from the Request. What I know is that I can read it like this

var rangeHeader = context.HttpContext.Request.Headers["Range"]

but then I have to split the string to get range from and to values because range header comes like this byte=100-512

So is this the right way to read this header from IHeaderDictonary or is there a better way to do this?

Pawan Nogariya
  • 8,330
  • 12
  • 52
  • 105

1 Answers1

0

I just found out what might be the "official" way to do it:

Add the following nuget to your project «Microsoft.AspNetCore.Http.Extensions».

And then do this:

var range = context.Request.GetTypedHeaders().Range;

And you're done :)

Kino101
  • 765
  • 8
  • 18