通过传递FedAuth Cookie使用AJAX调用WCF服务 [英] Call a WCF service using AJAX by passing FedAuth Cookie

查看:97
本文介绍了通过传递FedAuth Cookie使用AJAX调用WCF服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

如何通过拨打AJAX调用将FedAuth cookie传递给WCF服务.

How can I pass FedAuth cookie to a WCF service by making an AJAX call.

让我解释一下我的目标,我在不同的域中有一个非SharePoint应用程序,我想通过进行AJAX调用来获取弹出窗口中的项目列表.从非SharePoint应用程序调用WCF服务 带有FedAuth cookie和WCF服务的服务器将使用通过AJAX调用传递的FedAuth cookie访问SharePoint并返回结果.

Let me explain my objective, I have an non SharePoint application in different domain and I wanted to make a get the list of items in a pop up by making an AJAX call. for which what I'm thinking of is call a WCF service from the non SharePoint application with FedAuth cookie and WCF service will access SharePoint with the FedAuth cookie passed from AJAX call and return back the result.

我尝试了这种方法,但没有在AJAX调用中获得FedAith cookie的值;

I tried this approach but not getting the FedAith cookie value in AJAX call;

$.ajax({
  类型:"GET",
   crossDomain:是的,
   xhrFields:{
    withCredentials:true
  },
                            
                            网址:" https://sharepoint.com/_trust/default.aspx ",
                            成功:功能(输出,状态,xhr){
                    alert(xhr.getResponseHeader("Set-Cookie"));

$.ajax({
  type: "GET",
  crossDomain: true,
  xhrFields: {
   withCredentials: true
  },
               
                url: "https://sharepoint.com/_trust/default.aspx",
                success: function (output, status, xhr) {
                    alert(xhr.getResponseHeader("Set-Cookie"));

              nbsp; b ("FedAuth"));                                           },
   错误:function(err){
      var innerHtml =";
   }
           });

                     alert(xhr.getResponseHeader("FedAuth"));                   
                },
   error: function (err) {
       var innerHtml = "";
   }
            });

有人可以帮我吗?

谢谢

Anoop

推荐答案

您好,Anoop-,尽管它可能并非您想要的那样,请参见Dennis的解决方案:

Hi Anoop- although it may not be exactly the way you want to do it, see Dennis' solution:


这篇关于通过传递FedAuth Cookie使用AJAX调用WCF服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆