SfPdfViewer component API Service sample not match signature ?

Hello,



I'm considering your UI kit to be used in my project, but I'have a problem with the SfPdfViewer component for webAssembly app.


  • I'm follow this tutorial : 


https://blazor.syncfusion.com/documentation/pdfviewer/getting-started/client-side-application/


And the note info  : https://www.syncfusion.com/kb/10346/how-to-create-pdf-viewer-web-service-application-in-asp-net-core?_ga=2.76151125.1159554419.1612878611-165318989.1612878611


  • But with the last today version 18.4.0.42 it's seems the signature of method not match the content send by pdfViewer :


This is your sample for the load method:


  1.         [AcceptVerbs("Post")]
  2.         [HttpPost]
  3.         [Microsoft.AspNetCore.Cors.EnableCors("MyPolicy")]
  4.         //Post action for Loading the PDF documents 
  5.         public IActionResult Load([FromBody] Dictionary<string, string> jsonObject)


And only this works for me for the same method :


     

 [AcceptVerbs("Post")]

        [HttpPost("Load")]

        //Post action for Loading the PDF documents   

        public async System.Threading.Tasks.Task<IActionResult> LoadAsync()

        {

            string requestBody = await new StreamReader(HttpContext.Request.Body).ReadToEndAsync();

            var jsonObject = JsonConvert.DeserializeObject<Dictionary<string,string>>(requestBody);



  • I'm using a blazorWebAssemblyapp ASP.NETCore hosted


I send you in attachement a sample project to reproduce


Thanks,


Best regards,

Nicolas



Attachment: BlazorAppTESTWebAssembly__Send_HL_50b0dd71.zip

3 Replies 1 reply marked as answer

VS Vasugi Sivajothi Syncfusion Team February 12, 2021 04:09 PM UTC

 
Hi Nicolas, 
 
 
Thanks for contacting Syncfusion support. 
 
We have analyzed the code in the provided sample, We suspect that the reported issue occurs due not enabling the CORS in your sample . So kindly add the below code in the startup.cs file with in (ConfigureServices) method. In our PDFViewerController.cs file , we have provided the code ([Microsoft.AspNetCore.Cors.EnableCors("MyPolicy")]) before all our action method. So that the reported issue occurs in your end. 
app.UseCors(); 
 
We have created a simple sample for your reference. Please refer to the below sample, 
Kindly try it and revert us with more details if you still have concerns about this. 
 
Regards, 
Vasugi 
 


Marked as answer

NN Nicolas NOEL February 19, 2021 09:38 AM UTC

Hi Vasugi

You right the problem is the cors :

"We suspect that the reported issue occurs due not enabling the CORS in your sample"

Thanks you
Nicolas


VS Vasugi Sivajothi Syncfusion Team February 22, 2021 10:15 AM UTC

Hi Nicolas, 
 
 
Thank you for the update. We glad to know that the issue has been resolved. 
 
 
Regards, 
Vasugi 


Loader.
Up arrow icon