带ADFS的JSON [英] JSON with ADFS

查看:69
本文介绍了带ADFS的JSON的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我正在使用Windows Phone应用程序,该应用程序需要使用ADFS身份验证访问JSON API。 我正在尝试使用正确的凭据构建网络请求,但到目前为止还无法成功验证。 
基本代码如下:



 <预风格=" 背景:白色;颜色:黑色;字体家庭:索拉;字体大小:13像素">&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;的 <跨度风格= "颜色:#2b91af"> WebRequest的  WR =的 HttpWebRequest的。创建(json_url); 

System.Net。 NetworkCredential credentials = new System.Net。 NetworkCredential 用户名 密码 );
InitializeWebRequest(wr,credentials);

wr.Method = " GET" ;

JSONRequest request = new JSONRequest ();
request.OriginalCallback = originalCallback;
request.OriginalState = state;
request.Request = wr;
request.Callback = callback;

return wr.BeginGetResponse( new AsyncCallback (GetHelperAsyncContinue),request);



所以我正在创建一个具有正确用户名的NetworkCredential对象。密码&NBSP;但是,我收到了401回复此请求。 这适用于标准的WCF服务,但我无法找到一个示例,表明对于ADFS服务,需要以不同的方式执行
。 我应该如何设置Web请求的凭据,还是需要使用不同的方法来完全调用服务?

解决方案

嗨Josh,


您可以考虑将其发布在以下更合适的论坛上,以获得更有效的回复。谢谢!


wp7: http://forums.create .msdn.com /论坛/ Default.aspx的?的GroupID = 19个


Hello,

I'm working on a Windows Phone app which will needs to access a JSON API using ADFS authentication.  I'm attempting to construct a web request with the proper credentials but so far haven't been able to authenticate successfully.  The basic code is as follows:

            WebRequest wr = HttpWebRequest.Create(json_url);

System.Net.NetworkCredential credentials = newSystem.Net.NetworkCredential(username, password); InitializeWebRequest(wr, credentials); wr.Method = "GET"; JSONRequest request = newJSONRequest(); request.OriginalCallback = originalCallback; request.OriginalState = state; request.Request = wr; request.Callback = callback; return wr.BeginGetResponse(newAsyncCallback(GetHelperAsyncContinue), request);

So I'm creating a NetworkCredential object with a correct username and password.  However, I'm receiving a 401 response to this request.  This works with a standard WCF service, but I haven't been able to find an example of what needs to be done differently for an ADFS service.  How should I set the credentials of the web request, or do I need to use a different method of calling the service altogether?

解决方案

Hi Josh,

You can consider posting it at the following more appropriate forum for more efficient responses. Thanks!

wp7: http://forums.create.msdn.com/forums/default.aspx?GroupID=19


这篇关于带ADFS的JSON的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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