I can see a network share in explorer but when I use try to access it in my application I get "The network name cannot be found."
This is quite odd because the same server has other shares that I can access. For example:
string[] example_directories = new string[]{
Path.Combine(@"\\example01","vaqua"),
Path.Combine(@"\\example01","vaqua-pub"),
Path.Combine(@"\\example01","yesvirginiabeach"),
Path.Combine(@"\\example01","yesvirginiabeach-pub")
};
// output username
Console.WriteLine("User: " + WindowsIdentity.GetCurrent().Name);
// output each response to Directory.Exists
foreach (string directory in example_directories)
try
{
Console.WriteLine(directory + " : " + Directory.GetCreationTime(directory));
}
catch(Exception e)
{
Console.WriteLine(directory + " : " + e.Message.Trim());
}
Console.Read();
Output:
User: domain\myusername \\example01\vaqua : 10/22/2013 7:34:30 AM \\example01\vaqua-pub : 10/22/2013 7:57:42 AM \\example01\yesvirginiabeach : The network name cannot be found. \\example01\yesvirginiabeach-pub : 4/4/2013 10:31:07 AM
I can see all four of those shares on \example01 in explorer but the \example01\yesvirginiabeach
share just doesn't exist to my application.
These four shares all have the same permissions and I even print out my username to ensure the app is running with my creds.
I have had our admin re-share the directory and re-apply permissions to no avail.
Solution: My admin misspelled the share name:
\\example01\yesvirginiabeach
as \\example01\yesvirgniabeach
.