Solved

Correct way to do UNC

Posted on 2013-06-08
6
364 Views
Last Modified: 2013-06-09
For years, In my VB.NET Windows Application I have been storing what I thought was a UNC path as something like \\COVET\C\00a\test.pdf. Many of my users have used this naming with access from all computers on a network. Recently, I had a problem with two users. Upon testing with,

If System.IO.File.Exists(\\COVET\C\00a\test.pdf) = True Then

I get a path not found error even though the file is there. I started Googling UNC and it seems everyone uses \\Server\Folder\File with no drive letter. I thought perhaps the drive letter was unnecessary, but when I delete it to \\COVET\00a\test.pdf, my computer cannot find the file. This is driving me crazy.

Can someone tell me the correct way to store paths so everyone on a network can access the file?
0
Comment
Question by:LeeLiam
  • 4
  • 2
6 Comments
 
LVL 51

Expert Comment

by:Julian Hansen
Comment Utility
The "drive letter" as you refer to it has to be a share on the remote computer - you cannot refer to a native drive without it first being shared.

The exception is the hidden share of c$ - but that should be locked down and not used.

I guess you had a share on COVET C: drive shared as C and for some reason this share was removed or had security permissions changed

UNC should be \\Server\Share\Folder\Folder\Folder ... etc

Check the shares on COVET.
0
 

Author Comment

by:LeeLiam
Comment Utility
Ok, I think I get it. Yes on my Covet, the C drive is shared as C. So when you say "a share on the remote comuter", in my case it is the drive. But what I don't understand is what if the drive is not shared and the file is in the C:\Users\Public folder and it is shared. What would the UNC look like? Would it be \\Covet\Users\Public\test.pdf?
0
 
LVL 51

Accepted Solution

by:
Julian Hansen earned 500 total points
Comment Utility
If public folder is shared as "Public then the UNC would be

\\Covet\Public\test.pdf
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 51

Expert Comment

by:Julian Hansen
Comment Utility
That is assuming test.pdf is in the Public folder
0
 

Author Closing Comment

by:LeeLiam
Comment Utility
Excellent. I guess I was trying to make it harder than it really is.

Thanks for the help.
0
 
LVL 51

Expert Comment

by:Julian Hansen
Comment Utility
You are welcome - thanks for the help.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

772 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

11 Experts available now in Live!

Get 1:1 Help Now