HTTP HEAD request and System.Web.Mvc.FileResult

I use BITS to query an ASP.NET MVC controller named Source, which returns a FileResult. I know that the FilePathResult type uses HttpResponse.TransmitFile, but I don’t know if HttpResponse.TransmitFile really writes the file to the response stream, regardless of the type of request.

My question is, does FileResult only contain header information about HEAD requests or does it transfer the file regardless of request type? Or should I respond to HEAD requests myself?

+4
source share
1 answer

The result is forced to respond to the request using YOUR ACTION. If you are not doing anything special with different types of requests (for example, [HttpGet] -Attribute, HttpMethodConstraints in a route, etc.), the file is simply written to the response stream.

0
source

Source: https://habr.com/ru/post/1338470/


All Articles