Articles in this section
Category / Section

How to resolve the Routing issue in ASP.NET MVC application?

Published:
Updated:

You will get the issue Multiple actions were found that matches the request for report viewer and report designer Web API in the ASP.NET MVC application controller when the Web API is not routed properly with action. You have to create all the Web API methods with the ActionName and NonAction attributes as shown below.

public class ReportApiController : ApiController, IReportController
    {
        [System.Web.Http.ActionName("PostReportAction")]
        // Post action for processing the RDL/RDLC report
        public object PostReportAction(Dictionary<string, object> jsonResult)
        {
            return ReportHelper.ProcessReport(jsonResult, this);
        }

        // Get action for getting resources from the report
        [System.Web.Http.ActionName("GetResource")]
        [AcceptVerbs("GET")]

        public object GetResource(string key, string resourcetype, bool isPrint)
        {
            return ReportHelper.GetResource(key, resourcetype, isPrint);
        }

        [NonAction]
        // Method that will be called when initialize the report options before start processing the report
        public void OnInitReportOptions(ReportViewerOptions reportOption)
        {
            // You can update report options here
        }

        [NonAction]
        // Method that will be called when reported is loaded
        public void OnReportLoaded(ReportViewerOptions reportOption)
        {
            // You can update report options here
        }
    }
Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied