C# UNC path stills works when using NetUseDel

Dani_S 2,726 Reputation points
2022-05-08T13:17:43.993+00:00

Hi,
I connect to UNC using C# NetUseAdd
NetUseAdd(null, 2, ref useinfo, out paramErrorIndex);
But when I use NetUseDel -NetUseDel(null, _uncPath, 2)
UNC path stills works.
How is can be solved ?
Thanks,

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,426 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,277 questions
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 56,766 Reputation points
    2022-05-08T15:28:38.403+00:00

    The NetUseAdd function creates a connection to a server, the same as using the net use utility. The windows file system supports UNC paths internally and doesn’t require a pre-existing connection.

    Note: creating a connection is handy when the credentials required are not the logged user or you want a mapped drive.


0 additional answers

Sort by: Most helpful