In my app I have a dialog in which the user can select a database backup location.
I want to warn the user if the location he/she selected is "probably not secure".
I want to consider the following locations secure:
I:\Backup
) or UNC notation(\\server2\backup
))How can I get this kind of info about a selected folder?
I know about the DriveInfo
class, but it only handles drive letters, not UNC paths.
How's this for a quick and dirty way to check - run the windows net use command and parse the output for the line with the network path of interest (e.g. \\vault2 ) and OK . Here's an example of the output: C:\>net use New connections will be remembered.
In Windows, if you have mapped network drives and you don't know the UNC path for them, you can start a command prompt (Start → Run → cmd.exe) and use the net use command to list your mapped drives and their UNC paths: C:\>net use New connections will be remembered.
The project management term network path refers to any consecutive or continuous series of work or project schedule activities that may form some sort of a connection with a number of logical relationships as designated in the project schedule network diagram.
Take a look at the PathIsNetworkPath function:
class Program
{
[DllImport("shlwapi.dll")]
private static extern bool PathIsNetworkPath(string pszPath);
static void Main(string[] args)
{
Console.WriteLine(PathIsNetworkPath("i:\Backup"));
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With