File.Copy Error

Discussion in 'ASP .Net' started by =?Utf-8?B?TWFyaw==?=, Jan 10, 2006.

  1. 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
    =?Utf-8?B?TWFyaw==?=, Jan 10, 2006
    #1
    1. Advertising

  2. Mark,

    Check the security rights of the account used for impersonating.

    Eliyahu

    "Mark" <> wrote in message
    news:...
    >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
    Eliyahu Goldin, Jan 10, 2006
    #2
    1. Advertising

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

    "Eliyahu Goldin" wrote:

    > Mark,
    >
    > Check the security rights of the account used for impersonating.
    >
    > Eliyahu
    =?Utf-8?B?TWFyaw==?=, Jan 10, 2006
    #3
  4. 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

    "Mark" <> wrote in message
    news:...
    > 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
    >
    > "Eliyahu Goldin" wrote:
    >
    >> Mark,
    >>
    >> Check the security rights of the account used for impersonating.
    >>
    >> Eliyahu

    >
    Eliyahu Goldin, Jan 10, 2006
    #4
  5. 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

    "Eliyahu Goldin" wrote:

    > 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
    >
    > "Mark" <> wrote in message
    > news:...
    > > 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
    > >
    > > "Eliyahu Goldin" wrote:
    > >
    > >> Mark,
    > >>
    > >> Check the security rights of the account used for impersonating.
    > >>
    > >> Eliyahu

    > >

    >
    >
    >
    =?Utf-8?B?TWFyaw==?=, Jan 10, 2006
    #5
  6. > 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
    Eliyahu Goldin, Jan 11, 2006
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve Richter
    Replies:
    4
    Views:
    5,427
    Steve Richter
    Apr 18, 2005
  2. Alex
    Replies:
    2
    Views:
    1,195
  3. Replies:
    26
    Views:
    2,075
    Roland Pibinger
    Sep 1, 2006
  4. dave
    Replies:
    6
    Views:
    996
  5. MaggotChild

    File::Copy::copy With File Handles

    MaggotChild, Oct 18, 2011, in forum: Perl Misc
    Replies:
    2
    Views:
    486
    Ilya Zakharevich
    Oct 22, 2011
Loading...

Share This Page