Windows Phone アプリケーションで、UAG によって保護されている SharePoint データを読み取ろうとしており、UAG へのセッション Cookie の受け渡しをサポートしたいと考えています。
ホワイト ペーパー、Building Windows Phone 7 applications with SharePoint 2010 Products and Unified Access Gateway (UAG) ( http://technet.microsoft.com/en-us/library/hh180841.aspx ) では、ユーザー資格情報を毎回 UAG に渡す方法を示しています。
しかし、UAG がクライアントに返すセッション Cookie を保存して再利用するにはどうすればよいでしょうか?
// ホワイト ペーパーの例
string url = String.Format(“{0}/my/_layouts/activityfeed.aspx?consolidated=true", AppSettings.Url);
System.Uri authServiceUri = 新しい Uri(url);
HttpWebRequest クライアント = WebRequest.CreateHttp(authServiceUri) as HttpWebRequest;
client.Headers["User-Agent"] = "Microsoft Office モバイル";
client.Headers["認証"] = "基本"
+ Convert.ToBase64String(Encoding.UTF8.GetBytes(AppSettings.Username + ":"
+ AppSettings.Password))+ System.Environment.NewLine;
// 応答を呼び出して処理します...
このブログ投稿、SharePoint 2010 向け Windows Phone 7 アプリケーションの開発、http://blogs.msdn.com/b/pstubbs/archive/2010/10/04/developing-windows-phone-7-applications-for-sharepoint-2010 .aspxは、FBA で認証し、リクエストで Cookie を渡す方法を示しています。しかし、これが UAG にどの程度当てはまるかはわかりません。
プライベートボイド認証()
{
System.Uri authServiceUri =new Uri("http://phone.contoso.com/_vti_bin/authentication.asmx");
HttpWebRequest spAuthReq = HttpWebRequest.Create(authServiceUri) as HttpWebRequest;
spAuthReq.CookieContainer = cookieJar;
spAuthReq.Headers["SOAPAction"] = "http://schemas.microsoft.com/sharepoint/soap/Login";
spAuthReq.ContentType = "text/xml; charset=utf-8";
spAuthReq.Method = "POST";
// SOAP メッセージをリクエストに追加します
spAuthReq.BeginGetRequestStream(新しい AsyncCallback(spAuthReqCallBack), spAuthReq);
}
// 認証され、Cookie が設定された後
ListsService.ListsSoapClient のリスト = 新しい ListsService.ListsSoapClient();
list.CookieContainer = cookieJar;