How can I troubleshoot a network share connection issue within a c# application?

iambriansreed

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.

TypeIA

(Answered and resolved in comments above...)

Double-check that the name "yesvirginiabeach" is correct. Make sure there's nothing crazy like a Unicode character that looks like an "i" but is really a different character. (Solution turned out to be that someone misspelled the name of the folder as "yesvirgniabeach".)

For similar problems one could try enumerating the shares to see what the program can see. There's also the NET USE command (open a Command Prompt and type net use /help; this tool shows all the shares currently being accessed and can open new shares from a command prompt, which sometimes gives useful status messages).

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I make Files search recursively within a network share?

From Dev

How can I make Files search recursively within a network share?

From Dev

How can i start my application when network connection is available?

From Dev

How can I share a folder on a network with samba?

From Dev

How should I troubleshoot this weird SSD issue?

From Dev

How can I set a network connection as metered?

From Dev

How do I troubleshoot a Silex application?

From Dev

How can I share my internet connection from windows to ubuntu?

From Dev

How can I share my WiFi connection through Bluetooth?

From Dev

How can I share my WiFi connection through Bluetooth?

From Dev

How else can I troubleshoot this cron job?

From Dev

How can I troubleshoot keryx 'UnicodeEncodeError' error?

From Dev

Unity not loading, how can I troubleshoot?

From Dev

How can I share files over a Windows network?

From Dev

How can I read the "friendly name" for a mapped network share?

From Dev

How can I share files over a Windows network?

From Dev

How can I share a USB drive on a wired network?

From Dev

How can I read the "friendly name" for a mapped network share?

From Dev

How to share wired network connection in 18.04

From Dev

How to share wired network connection in 18.04

From Dev

How do I troubleshoot network issues with my VPS?

From Dev

How do I troubleshoot network issues with my VPS?

From Dev

How can I share a picture from my application to Whatsapp?

From Dev

How can I share a single application window with TightVNC?

From Dev

How can I share code between my application and my service?

From Dev

How can I configure the network on my Kubuntu box to be a system connection

From Dev

How can i setup a guest-guest network connection with virtualbox?

From Dev

How can I force a connection to a specific WiFi network using nmcli?

From Dev

How can I update a Network Manager connection from the command line?

Related Related

  1. 1

    How can I make Files search recursively within a network share?

  2. 2

    How can I make Files search recursively within a network share?

  3. 3

    How can i start my application when network connection is available?

  4. 4

    How can I share a folder on a network with samba?

  5. 5

    How should I troubleshoot this weird SSD issue?

  6. 6

    How can I set a network connection as metered?

  7. 7

    How do I troubleshoot a Silex application?

  8. 8

    How can I share my internet connection from windows to ubuntu?

  9. 9

    How can I share my WiFi connection through Bluetooth?

  10. 10

    How can I share my WiFi connection through Bluetooth?

  11. 11

    How else can I troubleshoot this cron job?

  12. 12

    How can I troubleshoot keryx 'UnicodeEncodeError' error?

  13. 13

    Unity not loading, how can I troubleshoot?

  14. 14

    How can I share files over a Windows network?

  15. 15

    How can I read the "friendly name" for a mapped network share?

  16. 16

    How can I share files over a Windows network?

  17. 17

    How can I share a USB drive on a wired network?

  18. 18

    How can I read the "friendly name" for a mapped network share?

  19. 19

    How to share wired network connection in 18.04

  20. 20

    How to share wired network connection in 18.04

  21. 21

    How do I troubleshoot network issues with my VPS?

  22. 22

    How do I troubleshoot network issues with my VPS?

  23. 23

    How can I share a picture from my application to Whatsapp?

  24. 24

    How can I share a single application window with TightVNC?

  25. 25

    How can I share code between my application and my service?

  26. 26

    How can I configure the network on my Kubuntu box to be a system connection

  27. 27

    How can i setup a guest-guest network connection with virtualbox?

  28. 28

    How can I force a connection to a specific WiFi network using nmcli?

  29. 29

    How can I update a Network Manager connection from the command line?

HotTag

Archive