Cross-Domain Cookies

后端 未结 15 2527
抹茶落季
抹茶落季 2020-11-21 21:56

I have two webapps WebApp1 and WebApp2 in two different domains.

  1. I am setting a cookie in WebApp1 in the HttpResponse.
  2. How to read the same cookie fro
15条回答
  •  离开以前
    2020-11-21 22:42

    function GetOrder(status, filter) {
        var isValid = true; //isValidGuid(customerId);
        if (isValid) {
            var refundhtmlstr = '';
            //varsURL = ApiPath + '/api/Orders/Customer/' + customerId + '?status=' + status + '&filter=' + filter;
            varsURL = ApiPath + '/api/Orders/Customer?status=' + status + '&filter=' + filter;
            $.ajax({
                type: "GET",
                //url: ApiPath + '/api/Orders/Customer/' + customerId + '?status=' + status + '&filter=' + filter,
                url: ApiPath + '/api/Orders/Customer?status=' + status + '&filter=' + filter,
                dataType: "json",
                crossDomain: true,
                xhrFields: {
                    withCredentials: true
                },
                success: function (data) {
                    var htmlStr = '';
                    if (data == null || data.Count === 0) {
                        htmlStr = '
    Bu kriterlere uygun sipariş bulunamadı.
    '; } else { $('#ReturnPolicyBtnUrl').attr('href', data.ReturnPolicyBtnUrl); var groupedData = data.OrderDto.sort(function (x, y) { return new Date(y.OrderDate) - new Date(x.OrderDate); }); groupedData = _.groupBy(data.OrderDto, function (d) { return toMonthStr(d.OrderDate) }); localStorage['orderData'] = JSON.stringify(data.OrderDto); $.each(groupedData, function (key, val) { var sortedData = groupedData[key].sort(function (x, y) { return new Date(y.OrderDate) - new Date(x.OrderDate); }); htmlStr += '
    ' + key + '
    '; $.each(sortedData, function (keyitem, valitem) { //Date Convertions if (valitem.StatusDesc != null) { valitem.StatusDesc = valitem.StatusDesc; } var date = valitem.OrderDate; date = date.substring(0, 10).split('-'); date = date[2] + '.' + date[1] + '.' + date[0]; htmlStr += '
    ' + //'
    Sipariş No: ' + valitem.OrderNumber + '' + date + '
    ' + '
    Sipariş No: ' + valitem.OrderNumber + '' + date + '
    ' + '
    ' + valitem.StatusDesc + '
    ' + '
    ' + '
    '; var i = 0; $.each(valitem.ItemList, function (keylineitem, vallineitem) { var imageUrl = vallineitem.ProductImageUrl.replace('{size}', 200); htmlStr += '
    ' + vallineitem.ProductName + '' + ProductNameStr(vallineitem.ProductName) + '
    '; i++; }); htmlStr += '
    ' + '
    ' + '
    '; }); }); $.each(data.OrderDto, function (key, value) { if (value.IsSAPMigrationflag === true) { refundhtmlstr = '
    Notification : Geçmiş siparişleriniz yükleniyor. Lütfen kısa bir süre sonra tekrar kontrol ediniz. Teşekkürler.
    '; } }); } $('#orders').html(htmlStr); $("#notification").html(refundhtmlstr); ApplySlide(); }, error: function () { console.log("System Failure"); } }); } }

    Web.config

    Include UI origin and set Allow Crentials to true

    
          
            
            
            
            
          
        
    

提交回复
热议问题