特別なSharepointページでホストされているascxカスタムコントロール(Webパーツではない)があります。このページでは、ユーザーがサーバーにファイルをアップロードできます。残念ながら、アクセス許可の問題により、Sharepointがファイルをネットワーク上の場所に保存できません。
Sharepoint 2007ベースのサイトのアプリケーションプールに起因するネットワークアカウントには、その場所に付与された「変更」および「読み取り」アクセス権があります。
アプリケーションプールアカウントで使用される資格情報を使用して別のマシンにログインし、指定されたネットワークの場所に問題なくディレクトリとファイルを作成できます。
SharepointがIIS7のアプリケーションプールに設定されているファイルではなく、他のアカウントを使用してこれらのファイルを保存しようとしている可能性はありますか?
発生しているエラー:
メッセージ:パス'\ opal \ gwl \ pictures\L36'へのアクセスが拒否されました。
スタックトレース: System.IO.__Error.WinIOError(Int32 errorCode、String mayFullPath)at System.IO.Directory.InternalCreateDirectory(String fullPath、String path、DirectorySecurity dirSecurity)at System.IO.Directory.CreateDirectory(String path、DirectorySecurity directorySecurity )ECan.SharePoint.Web.Applications.MyECan_WaterMeterFormDatalogger.SavePhotos()で
例外タイプ: System.UnauthorizedAccessException
ユーザー:システムアカウント
ascxコードビハインドファイルのSavePhotos関数のコード:
protected void SavePhotos()
{
string wellNo = WellNo.Value;
string epoWaterMeterID = EPO_WaterMeterID.Value;
string dirRoot = ConfigurationManager.AppSettings["PhotoDir"];
string map = wellNo.Substring(0, wellNo.IndexOf('/'));
int photoSaveCount = 1;
foreach (string filePath in Request.Files)
{
HttpPostedFile file = (HttpPostedFile)Request.Files[filePath];
if (file.InputStream.Length > 0)
{
try
{
// Create dir if does not exist
string dir = dirRoot + map;
if (!Directory.Exists(dir)) Directory.CreateDirectory(dir);
// Save file
file.SaveAs(dir + @"\" + wellNo.Replace('/', '_') + "-" + epoWaterMeterID.ToString() + "-" + photoSaveCount.ToString() + ".jpg");
photoSaveCount++;
}
catch (Exception ex)
{
Logger.Write(ex);
}
}
}
}
誰かが問題が何であるかについて何か考えを持っていますか?