Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy does MultipartFormDataContent not work when MVC is hosted in Azure?
    primarykey
    data
    text
    <p>I am having issues with post a form to MVC, but only when the site is hosted inside of azure. When it is hosted locally inside of IIS OR inside of the compute emulator it works fine.</p> <p>The request is posted, however the fields in the form are not being mapped to the action's parameters.</p> <p>Is there something funky I need to do with the azure deployment?</p> <pre><code>MultipartFormDataContent data = new MultipartFormDataContent(); if (!String.IsNullOrEmpty(about)) { data.Add(new StringContent(about), "about"); } data.Add(new StringContent(displayName), "displayName"); data.Add(new StringContent(name), "name"); data.Add(new StringContent(email), "email"); data.Add(new StringContent(phone), "phone"); data.Add(new StringContent(isPublic ? "true": "false"), "isPublic"); data.Add(new StringContent(isPrimary ? "true" : "false"), "isPrimaryProfile"); if (picture != null) { byte[] imageBytes = await picture.GetBtyeFromFile(); string imageString = Convert.ToBase64String(imageBytes); data.Add(new StringContent(imageString), "picture"); } Uri uri = new Uri(url, UriKind.Absolute); HttpResponseMessage responseMessage = await client.PostAsync(uri, data); </code></pre> <p>On the server side everything seems to be arriving correctly. Here is the body that I pulled out of the InputStream:</p> <pre><code>--614f8827-0cfe-48a6-a819-e6e9acdccae0 Content-Type: text/plain; charset=utf-8 Content-Disposition: form-data; name=displayName display --614f8827-0cfe-48a6-a819-e6e9acdccae0 Content-Type: text/plain; charset=utf-8 Content-Disposition: form-data; name=name Test Seller Account --614f8827-0cfe-48a6-a819-e6e9acdccae0 Content-Type: text/plain; charset=utf-8 Content-Disposition: form-data; name=email email --614f8827-0cfe-48a6-a819-e6e9acdccae0 Content-Type: text/plain; charset=utf-8 Content-Disposition: form-data; name=phone phone --614f8827-0cfe-48a6-a819-e6e9acdccae0 Content-Type: text/plain; charset=utf-8 Content-Disposition: form-data; name=isPublic false --614f8827-0cfe-48a6-a819-e6e9acdccae0 Content-Type: text/plain; charset=utf-8 Content-Disposition: form-data; name=isPrimaryProfile true --614f8827-0cfe-48a6-a819-e6e9acdccae0-- </code></pre> <p>And are the headers:</p> <pre><code>ALL_RAW - Content-Length: 880 Content-Type: multipart/form-data; boundary="614f8827-0cfe-48a6-a819-e6e9acdccae0" Host: [my server] </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload