작성 포맷 :
TEXT 모드, 자동 줄바꿈 사용
제 PC의 IIS에 소스를 올린 후 테스트 중
어떤 PC에서 다운로드를 해도 제 PC로 다운로드가 되고있습니다.
소스는 간단하게
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
WebClient wc = new WebClient();
wc.DownloadFile(new Uri(url), fullPath);
이렇게 사용하고 있습니다.
해결을 해보고자 사용자 PC의 IP를 추가하여 실행을 하자
System.UnauthorizedAccessException 엑세스 거부 에러가 발생하고 있습니다.
제발 도움 부탁드리겠습니다.
============================================================
올려주신 소스는 쉽게 표현 하자면... 현재 웹 서버로 파일을 다운로드 하는 코드 입니다.
즉 본인 PC가 서버이니... 본인 PC 에만 다운로드 되는 것입니다.
아래와 같은 방식으로 처리 하시기 바랍니다. ...[Mr.NET!]
protected void ExecuteFileDownload(string filePath, string strFile)
{
FileInfo _file = new System.IO.FileInfo(filePath);
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + strFile);
Response.AddHeader("Content-Length", _file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(_file.FullName);
Response.End();
} |