c# - AspNet MVC - return RedirectToAction is not working with image upload (if file.SaveAs gets called) -
return redirecttoaction not working if imageupload.saveas(path); executed otherwise working (i mean if not select image not reach line imageupload.saveas(path); ). here code: [httppost] public actionresult createnewemployee(employee emplview, httppostedfilebase imageupload) { if (!modelstate.isvalid) { var mod = new personaldetailsviewmodel(emplview); return view("addemployee", mod); } if (imageupload != null && imageupload.contentlength > 0) { var filename = emplview.employeeid + "_" + path.getfilename(imageupload.filename); var path = path.combine(server.mappath("~/content/images/"), filename); imageupload.saveas(path); emplview.photograph = filename; } _dbcontext.employees.add(emplview); _dbcontext.savechanges(); return redirecttoaction("personaldetails", new { id = emplv