We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now


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

Medium Priority
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?
Watch Question

Distinguished Expert 2019
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.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


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.

Distinguished Expert 2019

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'


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?!
Distinguished Expert 2019

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 (www.cacti.net)?
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).


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
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.