電子書籍の厳選無料作品が豊富!

vb.netでの記述方法について
以下のc#.netをvb.netで記述する場合、どうなるか教えてください。
よろしくお願い致します

public Task<HttpResponseMessage>PostFormData()
{
// Check if the request contains multipart/form-data.
if (!Request.Content.IsMimeMultipartContent())
{
throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);
}

string root = HttpContext.Current.Server.MapPath("~/App_Data");
var provider = new MultipartFormDataStreamProvider(root);

// Read the form data and return an async task.
var task = Request.Content.ReadAsMultipartAsync(provider).
ContinueWith<HttpResponseMessage>(t =>{
if (t.IsFaulted || t.IsCanceled)
{
Request.CreateErrorResponse(HttpStatusCode.InternalServerError, t.Exception);
}

// This illustrates how to get the file names.
foreach (MultipartFileData file in provider.FileData)
{
Trace.WriteLine(file.Headers.ContentDisposition.FileName);
Trace.WriteLine("Server file path: "+ file.LocalFileName);
}
return Request.CreateResponse(HttpStatusCode.OK);
});

return task;
}

A 回答 (1件)

    • good
    • 0
この回答へのお礼

遅れましたが回答ありがとうございました。

お礼日時:2019/09/18 17:43

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!