Click here to Skip to main content
15,442,007 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: PowerShell AND C# Pin
jochance6-Jul-22 10:15
Memberjochance6-Jul-22 10:15 
GeneralRe: PowerShell AND C# Pin
KLPounds5-Jul-22 3:06
MemberKLPounds5-Jul-22 3:06 
GeneralRe: PowerShell AND C# Pin
Kirk 103898215-Jul-22 6:30
MemberKirk 103898215-Jul-22 6:30 
Generalwordle Pin
jmaida1-Jul-22 8:12
Memberjmaida1-Jul-22 8:12 
GeneralRe: wordle Pin
OriginalGriff1-Jul-22 9:11
mveOriginalGriff1-Jul-22 9:11 
GeneralRe: wordle Pin
jmaida1-Jul-22 10:50
Memberjmaida1-Jul-22 10:50 
GeneralRe: wordle Pin
OriginalGriff1-Jul-22 11:05
mveOriginalGriff1-Jul-22 11:05 
GeneralA tale of rabbit holes and multipart/form Pin
Marc Clifton1-Jul-22 0:32
mvaMarc Clifton1-Jul-22 0:32 
I recently implemented a small service to handle uploads from the browser to our "media server" (rather legacy, don't ask) and on our dev server, no problem. On the actual media server box, I kept getting the dreaded no-access-control-allow-origin header.

Fussed with all the IIS settings and web.config settings to no avail.

Tested vanilla POST calls, all passed CORS without issues.

Learned about "simple requests" which multiform is one of and which don't do an OPTIONS preflight request.

Found an obscure post that people were getting this CORS error on ngnix when the file size was too large.

Tried uploading a a 1K file, and it worked!

Discovered that if the file size was somewhere between by 31K and 67K test files, the larger one failed.

Discovered that if I removed the docInfo parameter:

public IActionResult Upload([FromForm] DocumentUpload docInfo)

The endpoint was hit, no CORS error.

Was thinking, geez, what is .NET 6 doing? Do I have to parse the multiform data myself?

Found a post on the topic that mentioned this code:

var form = ControllerContext.HttpContext.Request.Form;

Tried that and to my horror, it threw an UnauthorizedAccessException that c:\windows\temp\[temp file] is not accessible.

Googled, added IIS AppPool\[my application pool] as a user to c:\windows\temp.

AND IT WORKED.

Unbelievable. An unauthorized access exception results in the browser giving me a CORS error!

This took all week to figure out, spending probably 6 hours a day on it. Sigh | :sigh:

And the small <30K file uploads worked without problems because it didn't require creating a temp file for the stream content. Sigh | :sigh:

GeneralRe: A tale of rabbit holes and multipart/form Pin
Greg Utas1-Jul-22 1:10
mveGreg Utas1-Jul-22 1:10 
GeneralRe: A tale of rabbit holes and multipart/form Pin
#realJSOP1-Jul-22 1:15
mva#realJSOP1-Jul-22 1:15 
GeneralRe: A tale of rabbit holes and multipart/form Pin
Greg Utas1-Jul-22 1:18
mveGreg Utas1-Jul-22 1:18 
GeneralRe: A tale of rabbit holes and multipart/form Pin
Randor 1-Jul-22 2:00
professional Randor 1-Jul-22 2:00 
GeneralRe: A tale of rabbit holes and multipart/form Pin
Marc Clifton1-Jul-22 7:59
mvaMarc Clifton1-Jul-22 7:59 
GeneralRe: A tale of rabbit holes and multipart/form Pin
Jacquers1-Jul-22 2:05
MemberJacquers1-Jul-22 2:05 
GeneralRe: A tale of rabbit holes and multipart/form Pin
raddevus1-Jul-22 3:09
mvaraddevus1-Jul-22 3:09 
GeneralRe: A tale of rabbit holes and multipart/form Pin
Marc Clifton1-Jul-22 8:02
mvaMarc Clifton1-Jul-22 8:02 
GeneralRe: A tale of rabbit holes and multipart/form Pin
obermd1-Jul-22 4:52
Memberobermd1-Jul-22 4:52 
GeneralRe: A tale of rabbit holes and multipart/form Pin
Richard Deeming4-Jul-22 21:58
mveRichard Deeming4-Jul-22 21:58 
GeneralSo I was thinking of getting a tattoo Pin
honey the codewitch30-Jun-22 22:32
mvahoney the codewitch30-Jun-22 22:32 
GeneralRe: So I was thinking of getting a tattoo Pin
OriginalGriff30-Jun-22 22:54
mveOriginalGriff30-Jun-22 22:54 
GeneralRe: So I was thinking of getting a tattoo Pin
Mycroft Holmes1-Jul-22 12:36
professionalMycroft Holmes1-Jul-22 12:36 
GeneralRe: So I was thinking of getting a tattoo Pin
Daniel Pfeffer1-Jul-22 0:49
professionalDaniel Pfeffer1-Jul-22 0:49 
GeneralRe: So I was thinking of getting a tattoo Pin
Gerry Schmitz1-Jul-22 3:54
mveGerry Schmitz1-Jul-22 3:54 
GeneralRe: So I was thinking of getting a tattoo Pin
Daniel Pfeffer1-Jul-22 5:00
professionalDaniel Pfeffer1-Jul-22 5:00 
GeneralRe: So I was thinking of getting a tattoo Pin
PIEBALDconsult1-Jul-22 6:01
professionalPIEBALDconsult1-Jul-22 6:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Straw Poll

What topics would you like to learn more about?
Contributed by Marc Clifton.
  Results   64 votes