IIS를 사용하여 업로드 한 웹 응용 프로그램이 있습니다. 나는 응용 프로그램을 사용하는 사용자가 자신의 (사용자) 컴퓨터에있는 파일을 선택하고 그 내용을 읽을 수 있기를 바랍니다.asp.net의 웹 응용 프로그램을 사용하여 내 PC에서 파일 찾아보기
코드는 다음과 같습니다
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에서 실행할 때 작동합니다.
Could not find a part of the path 'C:\Documents and Settings\myUser\Desktop\file.txt'.
나는 응용 프로그램이 사용자 PC에서 파일을 읽을 캔트 이해 : 나는 IIS에서 실행하려고 할 때 그러나 그것은 나에게 다음과 같은 오류를 제공합니다. 어떤 생각을 어떻게 할 수 있습니까?
감사합니다.
그렉
이것은 내가하고있는 일입니다. 내가 가진 : 그래서 사용자가 응용 프로그램이 그것을 읽을 수 있도록 파일을 업로드 할 수 있습니까? –
@grishaoks - asp.net ['FileUpload'] (http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.fileupload.aspx) 컨트롤을 사용하지 않는 이유는 무엇입니까? 업로드 된 바이트 스트림에 직접 액세스 할 수 있습니다. – Oded
그래, 지금 작동 :) 감사합니다! –