RE: WebClient.DownloadFile only see's Local????
- From: "DEWright_CA@xxxxxxxxxxxxx" <dewright_ca@xxxxxxxxxxxxx>
- Date: Fri, 27 May 2005 08:01:02 -0700
Thanks Steven,
I am passing to the command a known URL, in a full
HTTP://SERVERNAME/Foldername/Subfolder/filename.ext format. I can verify that
the path is good as I can take the URL and send it to another window and have
it show.
so in all cases I am sending to the app;
myWebClient.DownloadFile("http://tgrams/imageviewer/mt/notes/20/ne/12/mt20300202.tif","mt20300202.tif")
as the actual tool. But the actual path is dropped out.
Thoughts?
--
D @ premierdata
"Steven Cheng[MSFT]" wrote:
> Hi Dewright,
>
> Welcome to ASP.NET newsgroup.
> From your description and the code snippet, you're performing a file
> downloading task and the source file may come from local disk or on a
> remote server and exposed through http url address. Also ,when the file is
> on remote address, you'll use Webclient.DownloadFile to retrieve it to
> local disk. However, you found that when calling the WebClient.DownLoad
> file, it'll always save the file under the "C:\Windows\System32" folder
> rather than your current app's folder, yes?
>
> Based on my understanding, the problem you met is likely caused by the
> Default "Current Directory" value of the ASP.NET worker process. Is the
> "fileName" you specified in
>
> myWebClient.DownloadFile(filePath,fileName);
>
> a relative path (or just a file name without full path), if so the runtime
> will assume that it's in the current directory and concate it with the
> current directory value. And for windows process, sub process will inherit
> the current directory value from it's parent process(creator process). And
> ASP.NET's worker process is created at the first time a certain asp.net
> page being requested by the IIS's service process, so it'll inherit the IIS
> process's current dir value which is
>
> "c:\windows\system32\inetsrv"
>
> You can call "System.IO.Directory.GetCurrentDirectory()" to verify this.
> Also, if you want to change the current dir value, we can use the
>
> System.IO.Directory.SetCurrentDirectory(Server.MapPath("~/"));
>
> to assign the application's root dir as the current dir. So I think you
> can try adjusting the current dir value before calling webclient.DownLoad
> file to see whether it helps.
>
> Thanks,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
>
>
.
- Follow-Ups:
- RE: WebClient.DownloadFile only see's Local????
- From: Steven Cheng[MSFT]
- RE: WebClient.DownloadFile only see's Local????
- References:
- WebClient.DownloadFile only see's Local????
- From: DEWright_CA
- RE: WebClient.DownloadFile only see's Local????
- From: Steven Cheng[MSFT]
- WebClient.DownloadFile only see's Local????
- Prev by Date: Re: Question about ExecuteScalar() function in ASP.NET
- Next by Date: DNS Server Error when Hitting Database?
- Previous by thread: RE: WebClient.DownloadFile only see's Local????
- Next by thread: RE: WebClient.DownloadFile only see's Local????
- Index(es):
Relevant Pages
|