Home All Groups Group Topic Archive Search About

DownloadFile give Acccess Denied when administrative share used

Author
24 Aug 2006 9:27 PM
Bill Sempf
Hi, all.  I have a networking question, really.  I have this line of code:

my.computer.network.downloadfile("\\1.2.3.4\c$\file.txt", "c:\ifle.txt",
"user", "pass")

When I run it, I get an access denied error from the framework.

If I go to the run menu on my workstation, and type:

\\1.2.3.4\c$\

And type in my credentials in the network dialog box, THEN run my code, it
works.

Now, in a certain way this makes sense.  I just don't understand totally how
DownloadFile is coded under the sheets, and I probably need to use the
System.Net classes to pass the credentials a different way.

But if someone could give me a heads up as to how, I would appreciate it.

Thanks!

S

Author
25 Aug 2006 12:06 AM
Herfried K. Wagner [MVP]
"Bill Sempf" <sempf@newsgroups.nospan> schrieb:
> I have a networking question, really.  I have this line of code:
>
> my.computer.network.downloadfile("\\1.2.3.4\c$\file.txt", "c:\ifle.txt",
> "user", "pass")
>
> When I run it, I get an access denied error from the framework.

Did you already try 'File.Copy'?

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>
Author
25 Aug 2006 2:07 AM
Bill Sempf
"Herfried K. Wagner [MVP]" wrote:

> "Bill Sempf" <sempf@newsgroups.nospan> schrieb:
> > I have a networking question, really.  I have this line of code:
> >
> > my.computer.network.downloadfile("\\1.2.3.4\c$\file.txt", "c:\ifle.txt",
> > "user", "pass")
> >
> > When I run it, I get an access denied error from the framework.
>
> Did you already try 'File.Copy'?
>

Where in File.Copy would I pass in the credentials?