내가 asp.net에서 초보자 해요, 어떤 파일을 다운로드 할 수 있습니다 최종 사용자에게 간단한 웹 애플리케이션을 작성하려면, 그 목적이 코드 쓰기 :
asp.net에서 다운로드 할 서버에서 파일을 찾을 수없는 이유는 무엇입니까?
string filePath = "~/beh/" + query[0].OstFileName;
FileInfo file = new FileInfo(filePath);
if (file.Exists) {
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "attachment; filename=" + query[0].OstFileName.Trim());
Response.TransmitFile(Server.MapPath("~/beh/" + query[0].OstFileName.Trim()));
Response.End();
} else {
Response.Write("<script>alert('File Not Found 1')</script>");
}
을하지만 코드를 실행할 때 다른 블록 경고를 얻을 , 파일을 찾을 수 없음 1 메시지를 의미합니다. 내 잘못은 어디에 있습니까? 감사합니다.