File.Copy Error

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

Guest

I get the error:
System.IO.FileNotFoundException: Could not find file "C:\mydir\myfile.xls"

Using the sub:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim Path As String = "C:\mydir\"
Dim File As String = "myfile.xls"
Dim PathFile As String
PathFile = Path & File
System.IO.File.Copy(PathFile, Path & "myfile2.xls", True)

End Sub

This is run in an ASP.Net application.

The web.config file uses the xml code:
<identity impersonate="true"/>

When the this xml code is commented out the File.Copy works but the rest of
the app fails.

Any work arounds?

Thanks, Mark
 
Mark,

Check the security rights of the account used for impersonating.

Eliyahu
 
Eliyahu -

Thanks for the suggestion.

It looks to me that the the account has full read/write rights.

I think it is a matter of secuity rights, but I don't really know much about
the subject of permissions and account impersonations. Any suggestions of
what to look for?

Do I need to add a userid/password to the XML statement:
<identity impersonate="true"/>

Thanks,
Mark
 
What account did you check? If identity impersonate="true" and you don't
specify the user in the web.config file. the application will run under the
account set in IIS.

Eliyahu
 
Eliyahu-

Thanks for your comments.

I needed to set the proper security/permissions for the default IIS account
of "domain_name\ISUR_domain_name"

Does that make sense?

This permission/account stuff (unfortunately) is not all that clear to me.
But obviuosly I need to get a handle on it if I want the app to run.

Thanks again,
Mark
 
I needed to set the proper security/permissions for the default IIS
account
of "domain_name\ISUR_domain_name"
Or you can use another account
This permission/account stuff (unfortunately) is not all that clear to me.
But obviuosly I need to get a handle on it if I want the app to run.
Exactly. When you are programming fo web, you have to be quite many-in-one.

Eliyahu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top