How to set PdfViewerAjaxRequestSettings AjaxHeaders property

Hi,

I am trying pass back to the server the __RequestVerificationToken token but it not working correctly. Please help.

Thanks,
Mike

@(Html.EJS().PdfViewer("pdfviewer").ServiceUrl("/FormViewer").DocumentPath(tnb.FormDataId)
                    .AjaxRequestSettings(new PdfViewerAjaxRequestSettings { AjaxHeaders = new object[] { new { __RequestVerificationToken = "Testingabc", MyOtherHeader = "Testing123" } } })
                    .AjaxRequestFailed("ajaxFailureRequest")
                    .DocumentLoad("documentLoad")
                    .EnableAnnotation(false)
                    .EnableDownload(false)
                    .EnableFreeText(false)
                    .EnableImportAnnotationMeasurement(false)
                    .EnableBookmark(false)
                    .EnableFormFields()
                    .ToolbarSettings(new PdfViewerToolbarSettings { ToolbarItems = "PageNavigationTool,MagnificationTool,PanTool,SelectionTool,SearchOption,PrintOption" })
                    .Render()
                )



2 Replies 1 reply marked as answer

VS Vasugi Sivajothi Syncfusion Team April 19, 2021 12:44 PM UTC

Hi Michael, 
 
Thanks for contacting Syncfusion support. 
 
We can include the Authorization token in the PDF Viewer AJAX request using the ajaxRequest headers properties available in AjaxRequestSettings and it will be included in every AJAX request send from PDF Viewer. We have shared the simple sample for your reference. Please refer to the below documentation and sample, 
 
Code Snippet: 
 
 
AjaxRequestSettings(new PdfViewerAjaxRequestSettings { WithCredentials = true, AjaxHeaders = new object[] { new { headerName = "Testingabc", headerValue = "Testing123" } } }) 
 
 

 
Kindly try this and revert to us with more details if you have any concerns about this. 
 
Regards, 
Vasugi 


Marked as answer

MI Michael April 19, 2021 05:06 PM UTC

Thank you!

Loader.
Up arrow icon