473,406 Members | 2,867 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,406 software developers and data experts.

Drive Mapping

Hi,

Attempting to determine if a drive mapping is present, and if it is not,
want to connect it. Anyone familiar with the .net classes that I would use
to accomplish this?

Thanks in advance.

Sample code is appreciated.
Nov 15 '05 #1
3 1602
This is an article covering your problem, with source code and examples:
http://www.codeproject.com/dotnet/pinvokeaddshare.asp
Title of this article says how to create a file share using .NET framework.
But if you really get down to bottom of it, there is no class or method in
..NET framework that accomplishes this task. This is the time when we take
help from PInvoke to call unmanaged Win32 API. The NetApi in Win32 platform
provides a rich set of functions that allows us to do network management.

--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Chris Fink" <ch*********@hotmail.com> schreef in bericht
news:uU**************@TK2MSFTNGP12.phx.gbl...
Hi,

Attempting to determine if a drive mapping is present, and if it is not,
want to connect it. Anyone familiar with the .net classes that I would use to accomplish this?

Thanks in advance.

Sample code is appreciated.

Nov 15 '05 #2
Jan,

No, this the time you take a look at the System.Management classes :-).

Willy.

"Jan Tielens" <ja*@no.spam.please.leadit.be> wrote in message
news:eQ**************@TK2MSFTNGP10.phx.gbl...
This is an article covering your problem, with source code and examples:
http://www.codeproject.com/dotnet/pinvokeaddshare.asp
Title of this article says how to create a file share using .NET framework. But if you really get down to bottom of it, there is no class or method in
.NET framework that accomplishes this task. This is the time when we take
help from PInvoke to call unmanaged Win32 API. The NetApi in Win32 platform provides a rich set of functions that allows us to do network management.

--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Chris Fink" <ch*********@hotmail.com> schreef in bericht
news:uU**************@TK2MSFTNGP12.phx.gbl...
Hi,

Attempting to determine if a drive mapping is present, and if it is not,
want to connect it. Anyone familiar with the .net classes that I would

use
to accomplish this?

Thanks in advance.

Sample code is appreciated.


Nov 15 '05 #3
Hi Willy

Do you have a small code snippet how you can do this? Because I'm not aware
how this can be done using the System.Management namespace. I agree it would
be (a lot) nicer than using PInvoke. Thx!

--
Greetz

Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:#a**************@TK2MSFTNGP10.phx.gbl...
Jan,

No, this the time you take a look at the System.Management classes :-).

Willy.

"Jan Tielens" <ja*@no.spam.please.leadit.be> wrote in message
news:eQ**************@TK2MSFTNGP10.phx.gbl...
This is an article covering your problem, with source code and examples:
http://www.codeproject.com/dotnet/pinvokeaddshare.asp
Title of this article says how to create a file share using .NET

framework.
But if you really get down to bottom of it, there is no class or method in .NET framework that accomplishes this task. This is the time when we take help from PInvoke to call unmanaged Win32 API. The NetApi in Win32

platform
provides a rich set of functions that allows us to do network management.
--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Chris Fink" <ch*********@hotmail.com> schreef in bericht
news:uU**************@TK2MSFTNGP12.phx.gbl...
Hi,

Attempting to determine if a drive mapping is present, and if it is not, want to connect it. Anyone familiar with the .net classes that I
would use
to accomplish this?

Thanks in advance.

Sample code is appreciated.



Nov 15 '05 #4

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

Similar topics

0
by: Vladimir | last post by:
How I can get the information about mapping path of the substituted drive from C# code. For example I have created the substitution using the command: C:\>subst r: "C:\Program Files" C:\>subst...
2
by: giloosh99 | last post by:
Hello, Im grabbing tables via VB code using visual foxpro ODBC drives. The tables directory is in a mapped network drive. The code works fine and does the job, however if the computer is idle for...
1
by: Tim | last post by:
I need to be able to control drive mapping on a win2000 server with C#. I will need to be able to check for it's existence (think I figured this out) and most importantly create a mapping to a...
1
by: skumar | last post by:
whenever a user log in in my web application, i am trying to Map a drive "V:/" to a network path which is unique to each user(but i have to map to drive V:/ only). As any number of users can login to...
3
by: skumar | last post by:
I want to map a drive to my web server at run time when a user clicks a link in my web application Is there a namespace in VB.net to Map drives Or is there a Shell command which directly runs...
0
by: fndjoum | last post by:
When using Visual Studio 2005, I was able to read the text file if it's in my local c:\ drive ifstream myfile; myfile.open("C:\\test.txt"); --------------> this works on local drive ...
13
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
I am actually trying to get the UNC path of the main module of a process running from a mapped drive, and I am trying to do this from a service. The ProcessModule class only provides the full path...
10
by: =?Utf-8?B?Z3JlYXRiYXJyaWVyODY=?= | last post by:
Sorry about that previous one. I pressed enter too early. How does one go about mapping a network drive in C#. i know you use MapNetworkDrive in scripting languages, but i'm not sure how to do it...
20
by: =?Utf-8?B?QnJpYW4gTmljaG9sc29u?= | last post by:
Hello, I'm trying to create an admin page that can run miscellaneous scripts for our IT department. Currently, I'm trying to create a script that can map a network drive for a user (e.g. a form...
5
by: Phil | last post by:
A file used by my application may be stored on a shared network drive, so that it can be accessed by different people using the same application. I have written some code that uses an...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.