We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Setting the Authorize header to use a bearer token

Thread ID:





121305 Nov 28,2015 11:38 AM UTC Dec 8,2015 05:27 PM UTC ASP.NET Web Forms 3
Tags: Uploadbox
Pedro Salgueiro
Asked On November 28, 2015 11:38 AM UTC


Can you please showcase how can I intercept the request being sent to the server to add an authorization token to the request?

Kind Regards,
Pedro Salgueiro

Ezhil S [Syncfusion]
Replied On December 1, 2015 03:12 PM UTC

Hi Pedro,

Thank you for contacting Syncfusion support.

To add an Authorization header on file upload request, we suggest you to use setRequestHeader in ClientSideOnBegin event. Using setRequestHeader you can add a header to Http request in xhr element. But for browsers below IE10 xhr will not be available in that case we suggest you to use ActiveXObject. Once the header is set you can access it in the handler from the HttpRequest.Headers. Please refer the following code example,
<ej:UploadBox ID="upload1" runat="server" SaveUrl="saveFiles.ashx" RemoveUrl="removeFiles.ashx" ClientSideOnBegin="OnBegin"></ej:UploadBox>

        function OnBegin(args) {

            if (!this._isXhrSupported()) // to check xhr supported browsers

                xhr = new ActiveXObject("Microsoft.XMLHTTP");


                xhr = new XMLHttpRequest(); // IE10 and below

            xhr.open("post", "saveFiles.ashx", true);

            xhr.setRequestHeader("Authorization", "Uploadbox");


Sample prepared can be downloaded from below link:

Please let us know if you have any other queries.

Ezhil S

Pedro Salgueiro
Replied On December 1, 2015 03:25 PM UTC

Hi Ezhil,

I'm sorry but either I placed this thread under the wrong category (asp.net) or it was moved by mistake. 

I am using the Javascript control and not the ASP.NET control. Is the begin event equivalent? Should we set the Cancel flag to true to prevent the control from making the request?

Because this issue was quite urgent for us I have also opened the incident 147914 related with the same topic.

Kind Regards,

Gurunathan A [Syncfusion]
Replied On December 8, 2015 05:27 PM UTC

Hi Pedro,

We apologies for the late reply.  

We have updated our response for your query in the incident which  was created from your account. So kindly follow up the incident for further queries.

Please let me know if any concerns.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon