IIS を使用してアップロードした Web アプリケーションがあります。アプリケーションを使用しているユーザーが、自分の (ユーザーの) コンピューターにあるファイルを選択して、その内容を読み取れるようにしたいと考えています。
コードは次のとおりです。
TextReader trs = new StreamReader(faFile.Value);
DataAccessLayer.clearFA();
string line = trs.ReadLine();
// Read all unneeded data
while (line != "** Start Data **")
{
line = trs.ReadLine();
}
line = trs.ReadLine();
while (line != null)
{
string[] words = line.Split('*');
// There is no message
if (words[4] == "")
{
DataAccessLayer.insertIntoFA(Int32.Parse(words[1]), words[3].Replace("'", ""));
}
else
{
DataAccessLayer.insertIntoFA(Int32.Parse(words[1]), words[4].Replace("'", ""));
}
line = trs.ReadLine();
}
}
PCから実行すると動作します。しかし、IIS から実行しようとすると、次のエラーが表示されます。
Could not find a part of the path 'C:\Documents and Settings\myUser\Desktop\file.txt'.
アプリケーションがユーザーの PC からファイルを読み取れないことを理解しています。どうすればそれを機能させることができますか?
ありがとう!
グレッグ