Skip to content

Minimal api iform#26453

Merged
Rick-Anderson merged 8 commits into
dotnet:mainfrom
sammychinedu2ky:minimal-api-iform
Jul 19, 2022
Merged

Minimal api iform#26453
Rick-Anderson merged 8 commits into
dotnet:mainfrom
sammychinedu2ky:minimal-api-iform

Conversation

@sammychinedu2ky
Copy link
Copy Markdown
Contributor

Pull request for this issue dotnet/AspNetCore.Docs.Samples#8 (comment)

@sammychinedu2ky
Copy link
Copy Markdown
Contributor Author

For some reason when you access the, endpoint (singlefile). It doesn't bind to IForm but the endpoint (/multiplefiles) binds well to IFormCollection

@sammychinedu2ky
Copy link
Copy Markdown
Contributor Author

@Rick-Anderson

@Rick-Anderson Rick-Anderson self-assigned this Jul 18, 2022
@Rick-Anderson
Copy link
Copy Markdown
Contributor

I get the same error with /singleFile and /multipleFiles
BadHttpRequestException: Support for binding parameters from an HTTP request's form is not currently supported if the request contains a "Cookie" HTTP request header. Use of an HTTP request form is not currently secure for HTTP requests in scenarios which require authentication.

@Rick-Anderson
Copy link
Copy Markdown
Contributor

Rick-Anderson commented Jul 19, 2022

@sammychinedu2ky the code works with FF developer but fails in Chrome with the above error. Like you said, /singleFile returns BadHttpRequestException: Required parameter "IFormFile file" was not provided from form file.

@martincostello wrote all this code, maybe he can explain what's going on.

UPDATE
Edge also works fine and Chrome when I browse as guest to get rid of the request cookie.
The offending request header in chrome is ai_user=JKUwS|2022-02-11T18:47:13.976Z which I think is application insights.

@sammychinedu2ky
Copy link
Copy Markdown
Contributor Author

@sammychinedu2ky the code works with FF developer but fails in Chrome with the above error. Like you said, /singleFile returns BadHttpRequestException: Required parameter "IFormFile file" was not provided from form file.

@martincostello wrote all this code, maybe he can explain what's going on.

UPDATE Edge also works fine and Chrome when I browse as guest to get rid of the request cookie. The offending request header in chrome is ai_user=JKUwS|2022-02-11T18:47:13.976Z which I think is application insights.

Hmmm..🤔 Would try it out in guest mode

@sammychinedu2ky
Copy link
Copy Markdown
Contributor Author

Doesn't still work for me in guest mode on Edge

@Rick-Anderson
Copy link
Copy Markdown
Contributor

Doesn't still work for me in guest mode on Edge

That's expected, see https://devblogs.microsoft.com/dotnet/asp-net-core-updates-in-net-7-preview-1/#minimal-api-improvements

@martincostello
Copy link
Copy Markdown
Member

The code that blocks requests with authentication cookies was recently removed, so I think it should work as expected in the next preview.

@sammychinedu2ky
Copy link
Copy Markdown
Contributor Author

The code that blocks requests with authentication cookies was recently removed, so I think it should work as expected in the next preview.

Ooh ok

@sammychinedu2ky
Copy link
Copy Markdown
Contributor Author

Doesn't still work for me in guest mode on Edge

That's expected, see https://devblogs.microsoft.com/dotnet/asp-net-core-updates-in-net-7-preview-1/#minimal-api-improvements

Alright.. so that means the progress would be paused until the next preview right?

@martincostello
Copy link
Copy Markdown
Member

Yeah I think you'll need to wait until preview 7. This was the change: dotnet/aspnetcore#42586

@sammychinedu2ky
Copy link
Copy Markdown
Contributor Author

Yeah I think you'll need to wait until preview 7. This was the change: dotnet/aspnetcore#42586

alright thanks Martin🥂

@Rick-Anderson Rick-Anderson merged commit c013987 into dotnet:main Jul 19, 2022
@Rick-Anderson
Copy link
Copy Markdown
Contributor

@sammychinedu2ky S&M for now but we won't publish it until it's ready.

@sammychinedu2ky
Copy link
Copy Markdown
Contributor Author

@sammychinedu2ky S&M for now but we won't publish it until it's ready.

Alright Rick thanks🍸

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