473,385 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Is the file on a network share?

Hello group

Is there any way to tell, if a file is on a network share?

I know the path to the file, so I can easily get a FileInfo object, and I
can also use the Path class. However I can't find any way to use this
information to determine if the file is on a local disk, or on a mapped
network drive.

I'm asking, because I'm trying to enumerate all security groups that have
read access to the file. I can do this, but some of the groups can belong to
the build in domains, e.g. BULTIN\Users, and I need to know if this is the
Users group on a local computer, or the Users group on the file server. So
if you can help me do this translation instead, that would be perfect.

Thank you for your help

Regards
Anders
Feb 7 '06 #1
1 1772
Hi,

"Anders K. Olsen" <ak*****@hotmail.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
Hello group

Is there any way to tell, if a file is on a network share?

I know the path to the file, so I can easily get a FileInfo object, and I
can also use the Path class. However I can't find any way to use this
information to determine if the file is on a local disk, or on a mapped
network drive.


I really don't know if you can do this in managed code, there are two
options that I know of in unmanaged code:

1- Using WMI

2- Using GetDriveType win32 API call

It should be fairly trivial P/invoke it , so I would go that route


--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Feb 7 '06 #2

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

Similar topics

6
by: moonriver | last post by:
I write a program accessing files in network drive o:. It is doable as a standalone application. However, if it is running under windows service, the following exception will appear: 13/07/2004...
23
by: Lamberti Fabrizio | last post by:
Hi all, I've to access to a network file from an asp pages. I've red a lot of things on old posts and on Microsoft article but I can't still solve my problem. I've got two server inside the...
7
by: Frank Rizzo | last post by:
Hello, I've asked this question in the languages.vb group, but got no response, so I'll try my luck here. My app needs to copy a file from a local folder to a network share. The network share...
8
by: Lam | last post by:
HI anyone knows how can I open a mapped network file in C#? I try string file = @"T:\file.txt"; it shows me the error: "Could not find a part of the path" but if I copy the file to my C dirve,...
12
by: Mark | last post by:
Hello, in a simple console application I try to create a file with some code like: FileStream file = new FileStream("test.txt", FileMode.OpenOrCreate, FileAccess.Write); StreamWriter sw = new...
11
by: sur | last post by:
Hello, My problem is that File.Exists works fine if my file is on my local drive but returns false if its on any other drive. I think that the issue is probably file permissions and so I have...
7
by: Vai2000 | last post by:
Hi All, I have couple of servers in DMZ , I need to do some File I/O on them from my internal servers...The File I/O are going to be quite large so obviating WebService option (not sure about...
3
by: Alex | last post by:
Hi, I'm having a booger of a time trying to understand the policies for VB 2005 so I can run the EXE file from a network share via mapped drive. My first route was to use the Global Assembly...
0
by: =?Utf-8?B?UGhpbCBKb2huc29u?= | last post by:
Hi, We have a legacy asp application that uses a third party component to upload a file and saves it to a secure network share. The code sets the credentials for the secure network share on the...
0
by: cw808 | last post by:
Hi all. I'm new here but hoping I can get some help for my problem. My situation is that I need to upload files through a C# .NET web application to a file server. I done a search and followed...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.