New Folder in a UNC Path

Discussion in 'ASP .Net' started by Chris, Jan 6, 2009.

  1. Chris

    Chris Guest

    Hi,

    I have the following code, in which I'm trying to create a new folder
    inside a UNC path:

    DirectoryInfo oDir = new DirectoryInfo("\\\\server\\folder\\" +
    System.DateTime.Now.ToString("MM-dd-yy"));
    if (oDir.Exists == false)
    {
    try
    {
    oDir.Create();
    Response.Write("Created file");
    }
    catch (Exception ex)
    {
    Response.Write(ex.Message.ToString() +
    "<br>");
    }
    }

    When I try to run it, I get the following error:
    Access to the path ..... is denied.

    I have identity impersonate=true in my web config and I'm
    impersonating in the code, so the proper user/permissions should be
    used when it tries to create the folder, but it only works when I run
    a local debug. I can copy files to the folder, if it exists.
    Suggestions?
    Chris, Jan 6, 2009
    #1
    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. Kevin Joseph
    Replies:
    5
    Views:
    4,341
    Joe Smith
    Aug 13, 2004
  2. =?Utf-8?B?RGVhbiBNY0NhcnRlbg==?=

    Retrieving UNC Path of Mapped Drives on Client Machine

    =?Utf-8?B?RGVhbiBNY0NhcnRlbg==?=, Apr 30, 2004, in forum: ASP .Net
    Replies:
    7
    Views:
    5,599
    =?Utf-8?B?RGVhbiBNY0NhcnRlbg==?=
    May 20, 2004
  3. George Nevsky
    Replies:
    1
    Views:
    2,836
    Natty Gur
    May 16, 2004
  4. ksr
    Replies:
    5
    Views:
    7,861
    jcadow
    Feb 15, 2011
  5. MacMan0295

    How to create a folder from a UNC path

    MacMan0295, Dec 30, 2008, in forum: ASP General
    Replies:
    1
    Views:
    934
    Daniel Crichton
    Jan 5, 2009
Loading...

Share This Page