asp.net web api - jQuery BlueImp File Upload Authorization -


i trying implement jquery bluimp file upload control (from here: https://github.com/blueimp/jquery-file-upload) asp.net webapi backend, having little trouble. backend support mobile apps, enabled cors via (in register method of webapiconfig):

config.enablecors(new enablecorsattribute("*", "*", "*"));

the entire backend locked down authentication handler overriding sendasync method @ request.headers.authorization, pull out parameter , authenticate request issue lies. no matter try (including link: jquery-file-upload blueimp - additional headers), can't control send headers backend, thereby preventing me authenticating upload request before allowing save. various methods i've tried are:

        $(function() {           $('#fileupload').fileupload({             add: function(e, data) {               data.headers = {                 'authorization': 'basic ' + $.cookie('auth')               };               data.submit();             },             headers: {               authorization: 'basic ' + $.cookie('auth')             },             beforesend: function(xhr) {               xhr.setrequestheader("authorization", 'basic ' + $.cookie('auth'));             },             xhrfields: {               "authorization": 'basic ' + $.cookie('auth')             },             requestheaders: {               "authorization": 'basic ' + $.cookie('auth')             },             singlefileuploads: false,             datatype: 'jsonp',             url: window.core.get_serverurl() + 'upload/uploadcasefile',             done: function(e, data) {               $.each(data.result.files, function(index, file) {                 $('<p/>').text(file.name).appendto(document.body);               });             }           });         }); 

any ideas on how force thing send headers? i'm trying implement drag/drop file upload , don't need of features of control, seemed had nice options. if send headers, think i'd set.

this may little old however, people may run in future. there option including headers. treated of other options: i.e needed update options headers in "headers" object on options object.


Comments