Case 1
Let's see the code shown in the following:
- string rootPath = ConfigurationManager.AppSettings["FilePath"];
- var currentApplicationPath = HttpContext.Current.Request.PhysicalApplicationPath;
- var provider = new MultipartFormDataStreamProvider(currentApplicationPath + "\\tempUploads");
- try{
- await Request.Content.ReadAsMultipartAsync(provider);
- }
- catch(Exception ex)
- {
- throw ex;
- }
Here i am passing from header Accept: tex/json.
I am getting error. with used above code, error shown in the following screenshot:
Case 2
If I used MultipartFormDataStreamProvider with app ConfigurationManager.AppSettings["FilePath"] than I was successfully execute my code.
- string rootPath = ConfigurationManager.AppSettings["FilePath"];
- var provider = new MultipartFormDataStreamProvider(ConfigurationManager.AppSettings["FilePath"])
- try{
- await Request.Content.ReadAsMultipartAsync(provider);
- }
- catch(Exception ex)
- {
- throw ex;
- }

Suresh BhartiPosted Sep 29, 2015, 1:51 AM
nice suggestion