With windows 2000 is there a way to accsess local unc path locally

Posted on 2009-02-19
Last Modified: 2012-05-06
I have an application (written in csharp 2005)  that reads files stored in different folder. For all of these folders, I access them via a UNC path. Many of these folders are local to the machine (ex \\machine\folder is C:\folder). I noticed that even when I am accessing a local path since I am accessing it via an unc name, it creates network traffic and therefore is slower and subject to network problems. Can I tell the OS to treat local UNC path as local or is there a programmatic way I can do it with .NET?
Question by:SSAFECS
    LVL 76

    Accepted Solution

    Why not programatically check on which system the application is running and then use either the UNC path or a local path.  Additional checks can be added i.e. if a specific file exists in a local path to confirm you are on the right system and not on a system that was similarly named.

    It is puzzling that you are looking for a programmatic approach to modify/alter the OS/.Net framework instead of introducing some additional logic to your application to handle this.

    You effectively want to alter the .NET method to check whether the UNC path represents a local system.  Then translate the UNC path to its local  equivalent and then use the direct fileobject method rather than the network method to access your files.


    Author Comment

    Thanx for your comment I can modify the software on the next release but that will not be for a couple of months. We are currently experiencing network problems in our production environment and I was wondering if there is something I can do now to temporarily fix the problem. Perhaps via the hosts file

    As an aside I was wondering if there was a programmatic way of doing it.

    LVL 76

    Expert Comment

    I do not think so.  The fileobject method which I presume what you use to access the resource, switches functionality based on what is provided \\ means share requiring network related handling while the c:\ requires a different type of processing.

    One thing you can try on the local system is to add servername
    in c:\windows\system32\drivers\etc\hosts  This will try to access the share resource via the local loopback interface.

    Since you need this functionality for a single system, not sure how difficult it would be to add a check prior to calling the fileobject command;
    Am I on servername? True path='c:\folder':FALSE path='\\servername\folder'


    Author Comment

    Again thank you for your help I tried adding the server name to the c:\windows\system32\drivers\etc\hosts  as you suggested. Now we have 2 servers on the LAN machine name aa7 and machine name aa6. I was working on machine name aa7. However I added both aa6 and aa7 to the etc\hosts file and redirected them both to Then I cycled the DNS Client service. When I ping aa6 from aa7 I now get a reply from as I would expect. However when I ping aa7, the machine I am on to itself, I get a reply from the IP of the machine not the localhost?!
    LVL 76

    Expert Comment

    You have two systems with the same name on the network, or do you have a DNS record that points to two IPs which represent two different server names?

    Well then, the server when accessing itself does not consult the hosts file.
    Are you loadbalancing the share either through DFS or DNS?

    I still think the modification to the application is the quickest solution.  You know where the problem is, yet you are dancing around the issue trying to find an alternate more complex solution.
    Are there people looking into the network issue?

    Do you SNMP poll the system's network interfaces on the servers using an app like cacti (
    Even though the application has added overhead because of the tcp overhead, network issues should not affect the perfomance unless the amount of data that is flowing in/out from/to external sources pounds this server (saturates its NIC).

    Author Comment

    We don't have 2 systems with the same nameone system is named aa7 and one is named aa6 :) . We are fixing the issue in the code now. Again i was just hoping there was a temporary solution we could put in place

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK ( for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
    More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
    Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
    With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now