Click here to Skip to main content
15,921,279 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
API Code:
[HttpPost]
[Route("Upload")]
public HttpResponseMessage Upload([FromBody]FileUpload objFileUpl)
{
try
{
var AttachmentInfoResult = PLMRepository.PlmFileUpload(objFileUpl);
return Request.CreateResponse<attachmentinfo>(HttpStatusCode.OK, AttachmentInfoResult);
}
catch (Exception ex)
{
WriteToLog(ex);
return Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message.Replace("ERROR: ", ""));
}
}
MVC controller:


[HttpPost]
public JsonResult FilesUpload()
{
try
{

return this.Json(objAtList, JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
WriteToLog(ex, "UploadController");
throw;
}

Here in above exception in api should be thrown to mvc controller from where the api was triggered

What I have tried:

i tried throw in web api catch section
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900