目前我有发送身份验证令牌的所有ajax请求,但是我创建了一个导出到excel的服务,ajax不支持这个,我正在使用location.href来获取请求 . 有没有办法添加该令牌?
var getUrl = '/LandingView/ExportToExcel?excelHeader=' + excelHeader;
getUrl += '&companyId=' + $scope.options.companyId;
getUrl += '&startDate=' + $scope.options.startDate.toJSON();
getUrl += '&endDate=' + $scope.options.endDate.toJSON();
getUrl += '&page=' + $scope.options.page;
getUrl += '&stateFilter=' + $scope.options.stateFilter;
getUrl += '&rows=' + $scope.options.rows;
getUrl += '&alertFilter=' + $scope.options.alertFilter;
getUrl += '&mode=' + $scope.options.mode;
getUrl += '&showLanguages=' + $scope.options.showLanguages;
location.href = getUrl;
当我这样做时,我需要在标头中包含持票令牌 .
PS:我在后端使用ASP.NET MVC,在前端使用angularJS .