473,471 Members | 1,713 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Determining if a path is a network path (aka mapped drive - PathIsNetworkPath)

I am posting this because I couldn't find anything on the subject on
Usenet. Thanks to my good friend Oliver for the tip! Tested and
works on XP Pro.
using System;
using System.Runtime.InteropServices;

namespace NetPathTest
{
class NetPath {
[DllImport("shlwapi.dll")]
public static extern bool PathIsNetworkPath(string path);
}

class Testing
{
[STAThread]
static void Main(string[] args)
{
string mydrive = @"I:\";

if (NetPath.PathIsNetworkPath( mydrive ) == true) {
Console.WriteLine( mydrive + " is a mapped drive" );
}
}
}
}
Nov 15 '05 #1
0 1546

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: HKannen | last post by:
Hi, can anyone tell me how I can find out if e.g. "T:\Folder\SubFolder" is a mapped networkdrive or a local drive when I get this string from a file open dialog ? Thanks
0
by: Grant_S | last post by:
I need to identify the path to a users "My Document" folder where the user has a roaming profile and their "My Documents" folder is mapped to a network share as the H drive (specifically H:\\ -...
8
by: Matt | last post by:
I am migrating from NT 4.0 (IIS 4) to 2003 Server (IIS 6). Our Intranet has numerous applications that utilize the FileSystemObject (FSO) and each one is returning a "Path not found." error. These...
1
by: Alex Stevens | last post by:
Hi All, I'm asking for opinion for the best way forward with storing the path of a network shared document in a SQL Server table. Essentially, I want to store in a part record the path to it's...
2
by: Sridhar | last post by:
Hi, I have a question. I am trying to write File Functions to read data from a file. This function accepts FilePath as the parameter and returns Byte() Array. Some times if the file is on the...
0
by: jarmar | last post by:
We have a network share \\fileserver1\share that users have mapped individually/manually to any drive letter of there liking , not thru a login script. I have created a network share...
4
by: Paul H | last post by:
I want to start putting my backends in a UNC path instead of a mapped drive... If a client wants the database on their existing mapped drive Q: then it is easy for my to create a Q: drive on my...
4
by: DMG | last post by:
I have <identity impersonate = "true" /& <authentication mode="Windows"/in the web.config. This is a 2.0 site. My Goal: I want to simply have the user browse to a file on a mapped drive and get...
5
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I am trying to accesss a Mapped Drive from my asp.net code running on IIS 6.0. I am using a FileUpload control and fileUpload.SaveAs() to save the file to the server. I want to save the file to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.