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

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

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

    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 Guest

  2. Similar Questions and Discussions

    1. "File Not Found" error when file exists
      Are you getting a HTTP Protocol 404 error or are you getting errors when you use a FileExists function? Do you have CF's global error template...
    2. "File Not Found" error when file exists
      We get "File not found" on our login file every few weeks. We use Windows 2000 server with MX 6.1 This has been happening for 2 years. Modifying...
    3. Can't create PS file - "no desktop printer exists for this spool type"
      I can create PDF files from Photoshop, Illustrator or from any eps file by dropping them on to Distiller, but I can't create a ps file. I don't have...
    4. File Not found 404 Error -- while the file exists and mostly loads.
      There is an ASP page in my site which sometimes gives file not found error. This page which is suppossedly missing exists on the server and...
    5. System.IO.IOException
      Hi all, Yesterday we upgraded our server to the 1.1 Framework. (from 1.0) Our project was also converted in Visual Studio to 1.1 Since we have...
  3. #2

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

    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 [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Natty Gur Guest

  4. #3

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

    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
    [url]http://groups.google.com/groups?q=System.IO.IOException+asp.net&start=10&hl =[/url]
    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? [url]http://www.gotdotnet.com[/url]

    --------------------
    | From: "Chad Crowder" <chad.crowder@gis.leica-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 Guest

  5. #4

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

    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" <yweng@online.microsoft.com> wrote in message
    news:j1MRYHMXDHA.2108@cpmsftngxa06.phx.gbl...
    > 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
    >
    [url]http://groups.google.com/groups?q=System.IO.IOException+asp.net&start=10&hl =[/url]
    > 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? [url]http://www.gotdotnet.com[/url]
    >
    > --------------------
    > | From: "Chad Crowder" <chad.crowder@gis.leica-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 Guest

  6. #5

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

    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" <yweng@online.microsoft.com> wrote in message
    news:RT0i6ZXXDHA.2184@cpmsftngxa06.phx.gbl...
    > 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
    > [url]http://msdn.microsoft.com/msdnmag/issues/01/11/security/default.aspx[/url]. 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? [url]http://www.gotdotnet.com[/url]
    >
    > --------------------
    > | From: "Chad Crowder" <chad.crowder@gis.leica-geosystems.com>
    > | References: <uaJhi7FXDHA.1900@TK2MSFTNGP10.phx.gbl>
    > <j1MRYHMXDHA.2108@cpmsftngxa06.phx.gbl>
    > | 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: <exrIT0NXDHA.1204@TK2MSFTNGP12.phx.gbl>
    > | Newsgroups: microsoft.public.dotnet.framework.aspnet
    > | NNTP-Posting-Host: 12.108.244.117
    > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP12.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" <yweng@online.microsoft.com> wrote in message
    > | news:j1MRYHMXDHA.2108@cpmsftngxa06.phx.gbl...
    > | > 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
    > | >
    > |
    >
    [url]http://groups.google.com/groups?q=System.IO.IOException+asp.net&start=10&hl =[/url]
    > | > 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? [url]http://www.gotdotnet.com[/url]
    > | >
    > | > --------------------
    > | > | From: "Chad Crowder" <chad.crowder@gis.leica-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 Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139