Log on error for FileCopy()

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

FileCopy("C:\sourceFile.ext", "server fodler/targetname.ext") '! <<<<----
ERROR - Exception Details: System.IO.IOException: Logon failure: unknown user name or bad password.
Can't copy the file to my SQL database

This doesn't work in VB Visual Studio IDE
Any workaround?
TIA
 
If this is a windows forms application, make sure you can manually (using
windows explorer) copy the file to the intended share.

If it's a web application, you'll have to make the share accessible to the
user the web app is running under. As the default web is
<machinename>\ASPNET, you'd have to verify that that user has rights. Or,
you can use <identity impersonate ... > in your web.config.
 
Hi Philip,

Thanks...
i'm using web app...how to use (identity impersonate ...> in web.config.
I have the web config open and uses this set of lines:

<authorization><!-- <allow users="[comma separated list of users]"
roles="[comma separated list of roles]"/><deny users="[comma separated list of users]"
roles="[comma separated list of roles]"/>
--></authorization>

i can't find the impersonation line...
tia
 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsent7/html/vxconImpersonation.asp

You can add
<identity impersonate="true"/> just above the <authorization> line you had.
This would run the web application as the windows user you are logged in as.
Note that you may have some issues with this if the web application is on a
remote machine and the network share is on yet another machine.


PTJ said:
Hi Philip,

Thanks...
i'm using web app...how to use (identity impersonate ...> in web.config.
I have the web config open and uses this set of lines:

<authorization><!-- <allow users="[comma separated list of users]"
roles="[comma separated list of roles]"/><deny
users="[comma separated list of users]"
roles="[comma separated list of roles]"/>
--></authorization>

i can't find the impersonation line...
tia
 
Back
Top