I have a fileresult method in asp.net mvc4 that returns a report in an excel file. Now, how can I return an error message from this method if my conditions are not satisfied! So how can we only return the file from this method ?! Thnks
You can change the signature of the action method to public ActionResult MyMethod() and return FileResult when ModelState.IsValid==true and ViewResult when ModelState.IsValid==false
public ActionResult MyMethod()
FileResult
ModelState.IsValid==true
ViewResult
ModelState.IsValid==false
Source: https://habr.com/ru/post/959188/More articles:Use an Excel pivot table as a data source for another pivot table - excelCache Specifications for i7 i7 Core - cachingEmber.js: controller issues, 'this', 'content' and model structure - javascriptphp fsockopen how to find out if a connection is alive - phpASP.NET MVC 4 FileResult - By mistake - c #Interrupting raw_input in a twisted program - pythonskewed callback - using KeyboardInterrupt - twistedCreating a SalesForce Guide Using the REST API in PHP - restHow to save file from jersey response? - javaOdd "cutouts" in Polygon when using OffsetPolygon from Angus Johnsons Clipper lib - c ++All Articles