RE: WebClient.DownloadFile only see's Local????

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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.)
>
>
>
.



Relevant Pages

  • Re: Scam?
    ... them to verify it. ... If, in the rare case they say it is good, obtain a ... the check cam in via DHL from England but it was from a US bank which ... issued the check, calling the business that fedex'd the check, ...
    (rec.games.pinball)
  • Re: Phone calls from organisations
    ... the tables on them until they realise the idiocy of calling someone out ... caller being willing to verify their identity to the recipient of the ...
    (uk.legal)
  • Re: Cancelling an auction with a bid
    ... Nice dodging, but you still lied, therefore you are still a liar, whether you like to ... I have just posted an apology to you for calling you a dumbass, ... will not be responding to any further negative comments you may have ... I of course will still be glad to verify who I claim to be if you want ...
    (alt.marketing.online.ebay)
  • Re: Users are not able to change the password
    ... Pull up the properties of a user in question and verify that the SELF ... principal has the permissions to change password. ... Remember certain users won't inherit ...
    (microsoft.public.windows.server.active_directory)
  • Re: Phone calls from organisations
    ... switch board (look up on google or yellow pages) to verify who they are. ... not answer the questions if it was me calling them. ...
    (uk.legal)