私はこの時間が長すぎて、そこにいる誰かが私のエラーを数秒で指摘できると確信しています。現在のhttprequestを変更した後のサーバーエラー
私の会社には、販売員(パワーポイント、動画など)の販売資料をダウンロードするipadアプリがあります。すべてのリソースは、SharePoint内のドキュメントライブラリにあります。ドキュメントライブラリをパブリックにする(そして安全性を低くする)のではなく、ドキュメントをフェッチするWebパーツを持つ.aspxページを作成しました。 ipadアプリケーションは.aspxページにアクセスし、「token」と「document」という2つのクエリを送信します。トークンは本質的にパスワードなので、Webパーツはipadアプリから来ていることを知っています。トークンが正しい場合、Webパーツは指定されたドキュメントを取得します。
ここは私の問題です。ドキュメントは必要なように取得され、配信されますが、別のドキュメントをダウンロードしようとすると、サーバー上の他の場所に移動すると、サーバーエラーが発生します。私はブラウザを閉じなければならない(別名セッションを終了する)。私は取得しています
エラーがここで説明されていますhttp://blog.tylerholmes.com/2008/07/problem-with-sharepoint.html
私は私のコードは、問題を引き起こしていることを知っているので、私は、しかし、そのブログに修正プログラムを使用したくない、と私がしたいです問題の根本を修正してください。
私のWebパーツのコードは以下の通りです:
protected override void CreateChildControls()
{
string toRender = string.Empty;
SPWeb webInUserContext = SPContext.Current.Web;
SPSite SiteInUserContext = SPContext.Current.Site;
Guid webGuid = webInUserContext.ID;
Guid siteGuid = SiteInUserContext.ID;
//gives visitors the authority to see the dam data
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(siteGuid))
{
using (SPWeb web = site.OpenWeb(webGuid))
{
using (DAM dam = new DAM())
{
String mystring = HttpContext.Current.Request.Url.AbsoluteUri;
//If the request contains the correct token
if (mystring.ToString().Contains("REgrgg0434GgdLk6"))
{
//Get the document data into a byte array
byte[] buf = new byte[0];
using (var wc = new System.Net.WebClient())
{
//Right now I'm just hard-coding a document url for testing, rather than
//getting it from the url query
String url = "http://web-dev/sites/damedit/DocLibrary/document.ppt";
System.Net.CredentialCache cc = new System.Net.CredentialCache();
cc.Add(new Uri(url), "NTLM", new System.Net.NetworkCredential("username", "password", "domain"));
wc.Credentials = cc;
buf = wc.DownloadData(url);
}
//Rewrite the current response so that it contains the document
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ContentType = "application/pdf";
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=\"document.ppt\"");
HttpContext.Current.Response.BinaryWrite(buf);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
}
}
}
}
});
base.CreateChildControls();
}
すべてのヘルプははるかに高く評価されるだろう!
あなたがリンクしたエラーがあなたのエラーであることを100%確信していますか?私はこれに尋ねます.NPLMが必要とする401,401,200のレスポンスチェーンを処理するには、iPad(またはモバイルサファリ)が大きな問題を抱えているためです。 –
はい、iPadアプリでもまだテストしていないからです。私はブラウザにURLを入力するだけで、Webパーツがドキュメントを正しく取得して配信することを確認しています。このWebパーツの全目標は、すべての認証を処理してiPadアプリを使用する必要がないようにすることです。 – willink