ASP.NET MVC 4 FileResult - In error

后端 未结 4 1568
我寻月下人不归
我寻月下人不归 2021-02-19 20:35

I have a simple Action on a controller which returns a PDF.

Works fine.

public FileResult GetReport(string id)
{
    byte[] fileBytes = _manager.GetRepor         


        
4条回答
  •  攒了一身酷
    2021-02-19 21:36

    Another workaround for handling prerequisites is to split download process into two stages. First is to check preconditions in server side method which is executed as ajax/post method.

    Then if these preconditions are fulfilled you can start download request (e.g. in onSuccess callback where it is checked the return value indicating fulfillment) in which (on server side) you will handle potential exceptions in a way as it was described in above posts.

提交回复
热议问题