Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimal api iform #26453

Merged
merged 8 commits into from
Jul 19, 2022
Merged

Conversation

sammychinedu2ky
Copy link
Contributor

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

@sammychinedu2ky
Copy link
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
Contributor Author

@Rick-Anderson

@Rick-Anderson Rick-Anderson self-assigned this Jul 18, 2022
@Rick-Anderson
Copy link
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
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
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
Contributor Author

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

@Rick-Anderson
Copy link
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
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
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
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
Member

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

@sammychinedu2ky
Copy link
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
Contributor

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

@sammychinedu2ky
Copy link
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