System.IO.IOException: Cannot create a file when that file already exists.

Discussion in 'ASP .Net' started by Chad Crowder, Aug 6, 2003.

  1. Chad Crowder

    Chad Crowder Guest

    Getting the following error on my production server whether the file exists
    or not:

    "System.IO.IOException: Cannot create a file when that file already exists."

    Here's the code generating the error (seems to be happening when I try
    creating a directory)

    If dirmgr.Exists("s:\blah\" & txt_name.Text) Then
    lblerror.Text = lblerror.Text & "Unable to build physical path. " &
    txt_name.Text & " & Contact Dev Team.<BR>"
    Else
    dirmgr.CreateDirectory("s:\blah\" & txt_name.Text)

    This code runs fine on my development server (only the path is c:\blah\blah
    instead of S). Also, my production server has failover cluser, and the s
    drive is the failover drive. I can't imagine that could be a problem, but
    thought I would mention it.

    Asside from that, the only other thing I can think of is that the framework
    version on my dev box says 1.1, and the one on my production server says:
    1.0.37 - surely that's not the cause is it? Permissions shouldn't be an
    issue (i've even tried as domain admin)

    I would appreciate any help on this, as I'm out of ideas, and can find no
    other documentation on this.
    - Chad
    Chad Crowder, Aug 6, 2003
    #1
    1. Advertising

  2. Chad Crowder

    Natty Gur Guest

    Hi,

    the default user that runs web application (system) don’t has rights to
    access network resources.

    Natty Gur, CTO
    Dao2Com Ltd.
    34th Elkalay st. Raanana
    Israel , 43000
    Phone Numbers:
    Office: +972-(0)9-7740261
    Fax: +972-(0)9-7740261
    Mobile: +972-(0)58-888377


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Natty Gur, Aug 7, 2003
    #2
    1. Advertising

  3. Chad Crowder

    [MSFT]Allen Guest

    I agree with Natty. The problem you are having is most likely caused by
    having no right to access network resources. Willy address a similar
    problem before. See
    http://groups.google.com/groups?q=System.IO.IOException asp.net&start=10&hl=
    en&lr=&ie=UTF-8&oe=UTF-8&selm=OELVHLBNCHA.2460%40tkmsftngp04&rnum=20.

    HTH,
    -Allen

    Disclaimer:
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Got .Net? http://www.gotdotnet.com

    --------------------
    | From: "Chad Crowder" <-geosystems.com>
    | Subject: System.IO.IOException: Cannot create a file when that file
    already exists.
    | Date: Wed, 6 Aug 2003 17:08:27 -0400
    | Lines: 29
    |
    | Getting the following error on my production server whether the file
    exists
    | or not:
    |
    | "System.IO.IOException: Cannot create a file when that file already
    exists."
    |
    | Here's the code generating the error (seems to be happening when I try
    | creating a directory)
    |
    | If dirmgr.Exists("s:\blah\" & txt_name.Text) Then
    | lblerror.Text = lblerror.Text & "Unable to build physical path. "
    &
    | txt_name.Text & " & Contact Dev Team.<BR>"
    | Else
    | dirmgr.CreateDirectory("s:\blah\" & txt_name.Text)
    |
    | This code runs fine on my development server (only the path is
    c:\blah\blah
    | instead of S). Also, my production server has failover cluser, and the s
    | drive is the failover drive. I can't imagine that could be a problem, but
    | thought I would mention it.
    |
    | Asside from that, the only other thing I can think of is that the
    framework
    | version on my dev box says 1.1, and the one on my production server says:
    | 1.0.37 - surely that's not the cause is it? Permissions shouldn't be an
    | issue (i've even tried as domain admin)
    |
    | I would appreciate any help on this, as I'm out of ideas, and can find no
    | other documentation on this.
    | - Chad
    |
    |
    |
    [MSFT]Allen, Aug 7, 2003
    #3
  4. Chad Crowder

    Chad Crowder Guest

    Thanks for the response.

    I understand that, but I'm trying to create a directory on the local drive.
    This isn't a mapped share. The drive is physically present on the web
    server, and if that web server fails, the other system physically takes over
    the drive (ie, a cluster). I've also added the local ASPNET account to the
    NTFS permissions on the folder, and it still fails.

    - Chad


    "[MSFT]Allen" <> wrote in message
    news:...
    > I agree with Natty. The problem you are having is most likely caused by
    > having no right to access network resources. Willy address a similar
    > problem before. See
    >

    http://groups.google.com/groups?q=System.IO.IOException asp.net&start=10&hl=
    > en&lr=&ie=UTF-8&oe=UTF-8&selm=OELVHLBNCHA.2460%40tkmsftngp04&rnum=20.
    >
    > HTH,
    > -Allen
    >
    > Disclaimer:
    > This posting is provided "AS IS" with no warranties, and confers no

    rights.
    > Got .Net? http://www.gotdotnet.com
    >
    > --------------------
    > | From: "Chad Crowder" <-geosystems.com>
    > | Subject: System.IO.IOException: Cannot create a file when that file
    > already exists.
    > | Date: Wed, 6 Aug 2003 17:08:27 -0400
    > | Lines: 29
    > |
    > | Getting the following error on my production server whether the file
    > exists
    > | or not:
    > |
    > | "System.IO.IOException: Cannot create a file when that file already
    > exists."
    > |
    > | Here's the code generating the error (seems to be happening when I try
    > | creating a directory)
    > |
    > | If dirmgr.Exists("s:\blah\" & txt_name.Text) Then
    > | lblerror.Text = lblerror.Text & "Unable to build physical path.

    "
    > &
    > | txt_name.Text & " & Contact Dev Team.<BR>"
    > | Else
    > | dirmgr.CreateDirectory("s:\blah\" & txt_name.Text)
    > |
    > | This code runs fine on my development server (only the path is
    > c:\blah\blah
    > | instead of S). Also, my production server has failover cluser, and the

    s
    > | drive is the failover drive. I can't imagine that could be a problem,

    but
    > | thought I would mention it.
    > |
    > | Asside from that, the only other thing I can think of is that the
    > framework
    > | version on my dev box says 1.1, and the one on my production server

    says:
    > | 1.0.37 - surely that's not the cause is it? Permissions shouldn't be an
    > | issue (i've even tried as domain admin)
    > |
    > | I would appreciate any help on this, as I'm out of ideas, and can find

    no
    > | other documentation on this.
    > | - Chad
    > |
    > |
    > |
    >
    Chad Crowder, Aug 7, 2003
    #4
  5. Chad Crowder

    Chad Crowder Guest

    It doesn't work creating folders under the same directory as the web
    application... same issue.

    I'm going to try figuring out why that server is showing that it's running
    version 1.03 of the dotnet framework. It shows that v1.1 was installed.

    Thanks,
    Chad

    "[MSFT]Allen" <> wrote in message
    news:...
    > Try creating a directory in your code under the folder where your web
    > application resides. Does it works? In addition, you may want to verify

    the
    > account your web application is running under. Please download tokedump
    > written by Keith Brown from
    > http://msdn.microsoft.com/msdnmag/issues/01/11/security/default.aspx. It
    > would show you what account the application is running under.
    >
    > -Allen
    >
    > Disclaimer:
    > This posting is provided "AS IS" with no warranties, and confers no

    rights.
    > Got .Net? http://www.gotdotnet.com
    >
    > --------------------
    > | From: "Chad Crowder" <-geosystems.com>
    > | References: <>
    > <>
    > | Subject: Re: System.IO.IOException: Cannot create a file when that file
    > already exists.
    > | Date: Thu, 7 Aug 2003 08:11:44 -0400
    > | Lines: 78
    > | X-Priority: 3
    > | X-MSMail-Priority: Normal
    > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
    > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
    > | Message-ID: <>
    > | Newsgroups: microsoft.public.dotnet.framework.aspnet
    > | NNTP-Posting-Host: 12.108.244.117
    > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
    > | Xref: cpmsftngxa06.phx.gbl

    microsoft.public.dotnet.framework.aspnet:165699
    > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    > |
    > | Thanks for the response.
    > |
    > | I understand that, but I'm trying to create a directory on the local
    > drive.
    > | This isn't a mapped share. The drive is physically present on the web
    > | server, and if that web server fails, the other system physically takes
    > over
    > | the drive (ie, a cluster). I've also added the local ASPNET account to
    > the
    > | NTFS permissions on the folder, and it still fails.
    > |
    > | - Chad
    > |
    > |
    > | "[MSFT]Allen" <> wrote in message
    > | news:...
    > | > I agree with Natty. The problem you are having is most likely caused

    by
    > | > having no right to access network resources. Willy address a similar
    > | > problem before. See
    > | >
    > |
    >

    http://groups.google.com/groups?q=System.IO.IOException asp.net&start=10&hl=
    > | > en&lr=&ie=UTF-8&oe=UTF-8&selm=OELVHLBNCHA.2460%40tkmsftngp04&rnum=20.
    > | >
    > | > HTH,
    > | > -Allen
    > | >
    > | > Disclaimer:
    > | > This posting is provided "AS IS" with no warranties, and confers no
    > | rights.
    > | > Got .Net? http://www.gotdotnet.com
    > | >
    > | > --------------------
    > | > | From: "Chad Crowder" <-geosystems.com>
    > | > | Subject: System.IO.IOException: Cannot create a file when that file
    > | > already exists.
    > | > | Date: Wed, 6 Aug 2003 17:08:27 -0400
    > | > | Lines: 29
    > | > |
    > | > | Getting the following error on my production server whether the file
    > | > exists
    > | > | or not:
    > | > |
    > | > | "System.IO.IOException: Cannot create a file when that file already
    > | > exists."
    > | > |
    > | > | Here's the code generating the error (seems to be happening when I

    try
    > | > | creating a directory)
    > | > |
    > | > | If dirmgr.Exists("s:\blah\" & txt_name.Text) Then
    > | > | lblerror.Text = lblerror.Text & "Unable to build physical
    > path.
    > | "
    > | > &
    > | > | txt_name.Text & " & Contact Dev Team.<BR>"
    > | > | Else
    > | > | dirmgr.CreateDirectory("s:\blah\" & txt_name.Text)
    > | > |
    > | > | This code runs fine on my development server (only the path is
    > | > c:\blah\blah
    > | > | instead of S). Also, my production server has failover cluser, and
    > the
    > | s
    > | > | drive is the failover drive. I can't imagine that could be a

    problem,
    > | but
    > | > | thought I would mention it.
    > | > |
    > | > | Asside from that, the only other thing I can think of is that the
    > | > framework
    > | > | version on my dev box says 1.1, and the one on my production server
    > | says:
    > | > | 1.0.37 - surely that's not the cause is it? Permissions shouldn't

    be
    > an
    > | > | issue (i've even tried as domain admin)
    > | > |
    > | > | I would appreciate any help on this, as I'm out of ideas, and can

    find
    > | no
    > | > | other documentation on this.
    > | > | - Chad
    > | > |
    > | > |
    > | > |
    > | >
    > |
    > |
    > |
    >
    Chad Crowder, Aug 11, 2003
    #5
  6. Chad Crowder

    [MSFT]Allen Guest

    Chad, was the problem resolved? It seems that you installed both v1.03 and
    v1.1 on the same web server. If so, it might be helpful to look at the
    article "Compatibility Considerations and Version Changes" on
    http://www.gotdotnet.com/team/changeinfo/default.aspx. Try configuring your
    web application to run V1.03 and V1.1 specifically to see how it works.

    -Allen

    Disclaimer:
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Got .Net? http://www.gotdotnet.com

    --------------------
    | From: "Chad Crowder" <-geosystems.com>
    | References: <>
    <>
    <>
    <>
    | Subject: Re: System.IO.IOException: Cannot create a file when that file
    already exists.
    | Date: Mon, 11 Aug 2003 01:16:22 -0400
    | Lines: 141
    |
    |
    | It doesn't work creating folders under the same directory as the web
    | application... same issue.
    |
    | I'm going to try figuring out why that server is showing that it's running
    | version 1.03 of the dotnet framework. It shows that v1.1 was installed.
    |
    | Thanks,
    | Chad
    |
    | "[MSFT]Allen" <> wrote in message
    | news:...
    | > Try creating a directory in your code under the folder where your web
    | > application resides. Does it works? In addition, you may want to verify
    | the
    | > account your web application is running under. Please download tokedump
    | > written by Keith Brown from
    | > http://msdn.microsoft.com/msdnmag/issues/01/11/security/default.aspx. It
    | > would show you what account the application is running under.
    | >
    | > -Allen
    | >
    | > Disclaimer:
    | > This posting is provided "AS IS" with no warranties, and confers no
    | rights.
    | > Got .Net? http://www.gotdotnet.com
    | >
    | > --------------------
    | > | From: "Chad Crowder" <-geosystems.com>
    | > | References: <>
    | > <>
    | > | Subject: Re: System.IO.IOException: Cannot create a file when that
    file
    | > already exists.
    | > | Date: Thu, 7 Aug 2003 08:11:44 -0400
    | > | Lines: 78
    | > | X-Priority: 3
    | > | X-MSMail-Priority: Normal
    | > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
    | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
    | > | Message-ID: <>
    | > | Newsgroups: microsoft.public.dotnet.framework.aspnet
    | > | NNTP-Posting-Host: 12.108.244.117
    | > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
    | > | Xref: cpmsftngxa06.phx.gbl
    | microsoft.public.dotnet.framework.aspnet:165699
    | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    | > |
    | > | Thanks for the response.
    | > |
    | > | I understand that, but I'm trying to create a directory on the local
    | > drive.
    | > | This isn't a mapped share. The drive is physically present on the
    web
    | > | server, and if that web server fails, the other system physically
    takes
    | > over
    | > | the drive (ie, a cluster). I've also added the local ASPNET account
    to
    | > the
    | > | NTFS permissions on the folder, and it still fails.
    | > |
    | > | - Chad
    | > |
    | > |
    | > | "[MSFT]Allen" <> wrote in message
    | > | news:...
    | > | > I agree with Natty. The problem you are having is most likely caused
    | by
    | > | > having no right to access network resources. Willy address a similar
    | > | > problem before. See
    | > | >
    | > |
    | >
    |
    http://groups.google.com/groups?q=System.IO.IOException asp.net&start=10&hl=
    | > | >
    en&lr=&ie=UTF-8&oe=UTF-8&selm=OELVHLBNCHA.2460%40tkmsftngp04&rnum=20.
    | > | >
    | > | > HTH,
    | > | > -Allen
    | > | >
    | > | > Disclaimer:
    | > | > This posting is provided "AS IS" with no warranties, and confers no
    | > | rights.
    | > | > Got .Net? http://www.gotdotnet.com
    | > | >
    | > | > --------------------
    | > | > | From: "Chad Crowder" <-geosystems.com>
    | > | > | Subject: System.IO.IOException: Cannot create a file when that
    file
    | > | > already exists.
    | > | > | Date: Wed, 6 Aug 2003 17:08:27 -0400
    | > | > | Lines: 29
    | > | > |
    | > | > | Getting the following error on my production server whether the
    file
    | > | > exists
    | > | > | or not:
    | > | > |
    | > | > | "System.IO.IOException: Cannot create a file when that file
    already
    | > | > exists."
    | > | > |
    | > | > | Here's the code generating the error (seems to be happening when I
    | try
    | > | > | creating a directory)
    | > | > |
    | > | > | If dirmgr.Exists("s:\blah\" & txt_name.Text) Then
    | > | > | lblerror.Text = lblerror.Text & "Unable to build physical
    | > path.
    | > | "
    | > | > &
    | > | > | txt_name.Text & " & Contact Dev Team.<BR>"
    | > | > | Else
    | > | > | dirmgr.CreateDirectory("s:\blah\" & txt_name.Text)
    | > | > |
    | > | > | This code runs fine on my development server (only the path is
    | > | > c:\blah\blah
    | > | > | instead of S). Also, my production server has failover cluser,
    and
    | > the
    | > | s
    | > | > | drive is the failover drive. I can't imagine that could be a
    | problem,
    | > | but
    | > | > | thought I would mention it.
    | > | > |
    | > | > | Asside from that, the only other thing I can think of is that the
    | > | > framework
    | > | > | version on my dev box says 1.1, and the one on my production
    server
    | > | says:
    | > | > | 1.0.37 - surely that's not the cause is it? Permissions shouldn't
    | be
    | > an
    | > | > | issue (i've even tried as domain admin)
    | > | > |
    | > | > | I would appreciate any help on this, as I'm out of ideas, and can
    | find
    | > | no
    | > | > | other documentation on this.
    | > | > | - Chad
    | > | > |
    | > | > |
    | > | > |
    | > | >
    | > |
    | > |
    | > |
    | >
    |
    |
    |
    [MSFT]Allen, Aug 15, 2003
    #6
  7. Chad Crowder

    Chad Crowder Guest

    Allen,

    Thanks for the followup. I actually got my program working late last night.
    The problem was the framework version.

    I tried simply configuring the web application to use version 1.1, but that
    didn't help. I also tried uninstalling then reinstalling framework version
    1.1, but that also didn't get IIS to start using version 1.1 by default. I
    consequently uninstalled versions 1.1 *and* version 1.03, then only
    reinstalled version 1.1 again, and this took care of the problem.

    Thanks again for all the help everyone!

    - Chad

    "[MSFT]Allen" <> wrote in message
    news:...
    > Chad, was the problem resolved? It seems that you installed both v1.03 and
    > v1.1 on the same web server. If so, it might be helpful to look at the
    > article "Compatibility Considerations and Version Changes" on
    > http://www.gotdotnet.com/team/changeinfo/default.aspx. Try configuring

    your
    > web application to run V1.03 and V1.1 specifically to see how it works.
    >
    > -Allen
    >
    > Disclaimer:
    > This posting is provided "AS IS" with no warranties, and confers no

    rights.
    > Got .Net? http://www.gotdotnet.com
    >
    > --------------------
    > | From: "Chad Crowder" <-geosystems.com>
    > | References: <>
    > <>
    > <>
    > <>
    > | Subject: Re: System.IO.IOException: Cannot create a file when that file
    > already exists.
    > | Date: Mon, 11 Aug 2003 01:16:22 -0400
    > | Lines: 141
    > |
    > |
    > | It doesn't work creating folders under the same directory as the web
    > | application... same issue.
    > |
    > | I'm going to try figuring out why that server is showing that it's

    running
    > | version 1.03 of the dotnet framework. It shows that v1.1 was installed.
    > |
    > | Thanks,
    > | Chad
    > |
    > | "[MSFT]Allen" <> wrote in message
    > | news:...
    > | > Try creating a directory in your code under the folder where your web
    > | > application resides. Does it works? In addition, you may want to

    verify
    > | the
    > | > account your web application is running under. Please download

    tokedump
    > | > written by Keith Brown from
    > | > http://msdn.microsoft.com/msdnmag/issues/01/11/security/default.aspx.

    It
    > | > would show you what account the application is running under.
    > | >
    > | > -Allen
    > | >
    > | > Disclaimer:
    > | > This posting is provided "AS IS" with no warranties, and confers no
    > | rights.
    > | > Got .Net? http://www.gotdotnet.com
    > | >
    > | > --------------------
    > | > | From: "Chad Crowder" <-geosystems.com>
    > | > | References: <>
    > | > <>
    > | > | Subject: Re: System.IO.IOException: Cannot create a file when that
    > file
    > | > already exists.
    > | > | Date: Thu, 7 Aug 2003 08:11:44 -0400
    > | > | Lines: 78
    > | > | X-Priority: 3
    > | > | X-MSMail-Priority: Normal
    > | > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
    > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
    > | > | Message-ID: <>
    > | > | Newsgroups: microsoft.public.dotnet.framework.aspnet
    > | > | NNTP-Posting-Host: 12.108.244.117
    > | > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
    > | > | Xref: cpmsftngxa06.phx.gbl
    > | microsoft.public.dotnet.framework.aspnet:165699
    > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    > | > |
    > | > | Thanks for the response.
    > | > |
    > | > | I understand that, but I'm trying to create a directory on the local
    > | > drive.
    > | > | This isn't a mapped share. The drive is physically present on the
    > web
    > | > | server, and if that web server fails, the other system physically
    > takes
    > | > over
    > | > | the drive (ie, a cluster). I've also added the local ASPNET account
    > to
    > | > the
    > | > | NTFS permissions on the folder, and it still fails.
    > | > |
    > | > | - Chad
    > | > |
    > | > |
    > | > | "[MSFT]Allen" <> wrote in message
    > | > | news:...
    > | > | > I agree with Natty. The problem you are having is most likely

    caused
    > | by
    > | > | > having no right to access network resources. Willy address a

    similar
    > | > | > problem before. See
    > | > | >
    > | > |
    > | >
    > |
    >

    http://groups.google.com/groups?q=System.IO.IOException asp.net&start=10&hl=
    > | > | >
    > en&lr=&ie=UTF-8&oe=UTF-8&selm=OELVHLBNCHA.2460%40tkmsftngp04&rnum=20.
    > | > | >
    > | > | > HTH,
    > | > | > -Allen
    > | > | >
    > | > | > Disclaimer:
    > | > | > This posting is provided "AS IS" with no warranties, and confers

    no
    > | > | rights.
    > | > | > Got .Net? http://www.gotdotnet.com
    > | > | >
    > | > | > --------------------
    > | > | > | From: "Chad Crowder" <-geosystems.com>
    > | > | > | Subject: System.IO.IOException: Cannot create a file when that
    > file
    > | > | > already exists.
    > | > | > | Date: Wed, 6 Aug 2003 17:08:27 -0400
    > | > | > | Lines: 29
    > | > | > |
    > | > | > | Getting the following error on my production server whether the
    > file
    > | > | > exists
    > | > | > | or not:
    > | > | > |
    > | > | > | "System.IO.IOException: Cannot create a file when that file
    > already
    > | > | > exists."
    > | > | > |
    > | > | > | Here's the code generating the error (seems to be happening when

    I
    > | try
    > | > | > | creating a directory)
    > | > | > |
    > | > | > | If dirmgr.Exists("s:\blah\" & txt_name.Text) Then
    > | > | > | lblerror.Text = lblerror.Text & "Unable to build

    physical
    > | > path.
    > | > | "
    > | > | > &
    > | > | > | txt_name.Text & " & Contact Dev Team.<BR>"
    > | > | > | Else
    > | > | > | dirmgr.CreateDirectory("s:\blah\" & txt_name.Text)
    > | > | > |
    > | > | > | This code runs fine on my development server (only the path is
    > | > | > c:\blah\blah
    > | > | > | instead of S). Also, my production server has failover cluser,
    > and
    > | > the
    > | > | s
    > | > | > | drive is the failover drive. I can't imagine that could be a
    > | problem,
    > | > | but
    > | > | > | thought I would mention it.
    > | > | > |
    > | > | > | Asside from that, the only other thing I can think of is that

    the
    > | > | > framework
    > | > | > | version on my dev box says 1.1, and the one on my production
    > server
    > | > | says:
    > | > | > | 1.0.37 - surely that's not the cause is it? Permissions

    shouldn't
    > | be
    > | > an
    > | > | > | issue (i've even tried as domain admin)
    > | > | > |
    > | > | > | I would appreciate any help on this, as I'm out of ideas, and

    can
    > | find
    > | > | no
    > | > | > | other documentation on this.
    > | > | > | - Chad
    > | > | > |
    > | > | > |
    > | > | > |
    > | > | >
    > | > |
    > | > |
    > | > |
    > | >
    > |
    > |
    > |
    >
    Chad Crowder, Aug 19, 2003
    #7
  8. Chad Crowder

    hemant.yadav

    Joined:
    Oct 14, 2009
    Messages:
    2
    Location:
    Ahmedabad
    i am getting this error "Cannot create a file when that file already exists." when trying to execute the following code in c#...

    Directory.CreateDirectory("D:\\website\Folder1");

    Directory.Move("D:\\website\Folder", "D:\\website\Folder1");

    Directory.Delete("D:\\website\Folder");

    i want to copy the contect of the "folder" to "folder1" than delete the existing folder when i executed and traced the code its created the folder but when move the file its throughing the exception that "Cannot create a file when that file already exists.\r\w"

    please help me out.....
    hemant.yadav, Oct 24, 2009
    #8
    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. Krissy

    System.IO.IOException

    Krissy, Jul 30, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    875
    Krissy
    Jul 31, 2003
  2. Trevor
    Replies:
    4
    Views:
    4,495
    Peter Bromberg [C# MVP]
    May 8, 2008
  3. George
    Replies:
    1
    Views:
    6,146
    Jamie
    Feb 25, 2005
  4. Prabh
    Replies:
    3
    Views:
    574
    Roedy Green
    May 6, 2004
  5. Mentalis
    Replies:
    0
    Views:
    5,254
    Mentalis
    Jul 12, 2006
Loading...

Share This Page