Skip to content

Add file results documentation for Minimal APIs and controllers#37257

Open
mikekistler wants to merge 5 commits into
mainfrom
mdk/file-results
Open

Add file results documentation for Minimal APIs and controllers#37257
mikekistler wants to merge 5 commits into
mainfrom
mdk/file-results

Conversation

@mikekistler

@mikekistler mikekistler commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Adds documentation for file result return values in ASP.NET Core, covering both Minimal APIs and controller-based APIs.

What's included

  • File result typesTypedResults.File / ControllerBase.File() with byte[] and Stream
  • OpenAPI support — Using Produces<Stream> for binary, Produces<string> for text
  • Conditional requests — ETag and Last-Modified with 304 Not Modified
  • Range requestsenableRangeProcessing for partial content (206) responses

Code examples reference snippets in dotnet/AspNetCore.Docs.Samples (PR: dotnet/AspNetCore.Docs.Samples#312).


Internal previews

📄 File 🔗 Preview link
aspnetcore/fundamentals/minimal-apis/responses.md aspnetcore/fundamentals/minimal-apis/responses

Comment thread aspnetcore/fundamentals/minimal-apis/responses.md Outdated
Comment thread aspnetcore/fundamentals/minimal-apis/responses.md Outdated
Comment thread aspnetcore/fundamentals/minimal-apis/responses.md Outdated
Comment thread aspnetcore/fundamentals/minimal-apis/responses.md Outdated
Comment thread aspnetcore/fundamentals/minimal-apis/responses.md Outdated
Comment thread aspnetcore/fundamentals/minimal-apis/responses.md Outdated
Comment thread aspnetcore/fundamentals/minimal-apis/responses.md Outdated
Comment thread aspnetcore/fundamentals/minimal-apis/responses.md Outdated
@wadepickett

wadepickett commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Great content. I found a few minor items, with suggestions inline.

For the build issue warning of missing code:
The article references ~/../AspNetCore.Docs.Samples/fundamentals/minimal-apis/FileResults/10.x/... but on main only fundamentals/minimal-apis/samples/ exists: The new FileResults/10.x/ folder is in PR #312 and hasn't been merged. It should be merged first.

@wadepickett wadepickett left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, but review suggestions I made for some minor items inline and merge PR #312 first so the code will be found when this content builds again.

Comment on lines +286 to +287
<!-- Hope we can change this to IBinaryContent if #67145 is approved and implemented-->
The recommended `TResponse` for this case is `Stream`. The framework has special logic to map

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe FileContentResult, FileContentHttpResult, StreamContentResult, and StreamContentHttpResult were all added in .NET 11 and not backported to .NET 10. So only 'IFormFile, Stream, and PipeReader` will work in .NET 10.

mikekistler and others added 2 commits June 16, 2026 07:44
Co-authored-by: Wade Pickett <wpickett@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants