473,714 Members | 2,505 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Map network drive for user using VB/ASP.NET

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 where I can input \\path\folder, drive
letter, and domain\user). Is this possible? If so, can someone point me in
the right direction?

Thank you,
Brian Nicholson
Jun 29 '08 #1
20 7077
On Jun 29, 11:42*pm, Brian Nicholson
<BrianNichol... @discussions.mi crosoft.comwrot e:
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 where I can input \\path\folder, drive
letter, and domain\user). Is this possible? If so, can someone point me in
the right direction?

Thank you,
Brian Nicholson
Hi,
If you're meaning to transfer files across computers that are on the
same network, you can simply use it by calling mapped computer's name
with UNC path or network IP address:

My.Computer.Net work.DownloadFi le("\\MAPPED_PC \folder\file.ex e",c:
\file.exe")

Additionaly, you need to set networkCredenti als parameter if your
drives require network authentecation.

Hope this helps,

Onur Güzel
Jun 29 '08 #2
On Jun 30, 1:09*am, kimiraikkonen <kimiraikkone.. .@gmail.comwrot e:
On Jun 29, 11:42*pm, Brian Nicholson

<BrianNichol... @discussions.mi crosoft.comwrot e:
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 mapa
network drive for a user (e.g. a form where I can input \\path\folder, drive
letter, and domain\user). Is this possible? If so, can someone point me in
the right direction?
Thank you,
Brian Nicholson

Hi,
If you're meaning to transfer files across computers that are on the
same network, you can simply use it by calling mapped computer's name
with UNC path or network IP address:

My.Computer.Net work.DownloadFi le("\\MAPPED_PC \folder\file.ex e",c:
\file.exe")

Additionaly, you need to set networkCredenti als parameter if your
drives require network authentecation.

Hope this helps,

Onur Güzel
However you can do it also with System.IO.File. Copy using UNC

and, correcting my previous syntax as:

My.Computer.Net work.DownloadFi le("\\MAPPEDPC\ \file.exe","c:\ file.exe")

or one of System.IO.File' s methods to work with your mapped drive on
domain / workgroups using proper credentials.

HTH,

Onur G.
Jun 29 '08 #3

"Brian Nicholson" <Br************ @discussions.mi crosoft.comwrot e in
message news:29******** *************** ***********@mic rosoft.com...
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 where I can input \\path\folder,
drive
letter, and domain\user). Is this possible? If so, can someone point me in
the right direction?
As someone else said, you might not find a VB example, and as a good .Net
programmer, you need to know C# and VB. It's not that hard to translate.
There is no reason that you can't use the class for an ASP.Net solution.

There is also no reason you couldn't just take the class talked about as is,
compile as a C# dll, and set reference to the DLL and use it in your VB
project.

http://www.codeproject.com/KB/system/mapnetdrive.aspx

Jun 30 '08 #4
"Mr. Arnold" wrote:
>
As someone else said, you might not find a VB example, and as a good .Net
programmer, you need to know C# and VB. It's not that hard to translate.
There is no reason that you can't use the class for an ASP.Net solution.

There is also no reason you couldn't just take the class talked about as is,
compile as a C# dll, and set reference to the DLL and use it in your VB
project.

http://www.codeproject.com/KB/system/mapnetdrive.aspx

Thank you for the response. I have no problems using C# code; I just asked
that initially because it's what I'm most familiar with. I've come across
that class before, but the problem is that it requires the password of the
user I'm mapping a network drive for. I was hoping there was some way I
could use IIS Windows Authentication or something similar to do this with an
account that has administrative rights, so I wouldn't be required to know the
user's password.
Jun 30 '08 #5
"Brian Nicholson" wrote:
"Mr. Arnold" wrote:

As someone else said, you might not find a VB example, and as a good .Net
programmer, you need to know C# and VB. It's not that hard to translate.
There is no reason that you can't use the class for an ASP.Net solution.

There is also no reason you couldn't just take the class talked about as is,
compile as a C# dll, and set reference to the DLL and use it in your VB
project.

http://www.codeproject.com/KB/system/mapnetdrive.aspx
Thank you for the response. I have no problems using C# code; I just asked
that initially because it's what I'm most familiar with. I've come across
that class before, but the problem is that it requires the password of the
user I'm mapping a network drive for. I was hoping there was some way I
could use IIS Windows Authentication or something similar to do this with an
account that has administrative rights, so I wouldn't be required to know the
user's password.
I posted this same question in the ASP.NET newsgroup -- it appears what I
would like to do isn't feasible without resorting to ActiveX. Thanks for the
replies.
Jun 30 '08 #6

"Brian Nicholson" <Br************ @discussions.mi crosoft.comwrot e in
message news:2F******** *************** ***********@mic rosoft.com...
"Brian Nicholson" wrote:
>"Mr. Arnold" wrote:
>
As someone else said, you might not find a VB example, and as a good
.Net
programmer, you need to know C# and VB. It's not that hard to
translate.
There is no reason that you can't use the class for an ASP.Net
solution.

There is also no reason you couldn't just take the class talked about
as is,
compile as a C# dll, and set reference to the DLL and use it in your VB
project.

http://www.codeproject.com/KB/system/mapnetdrive.aspx

Thank you for the response. I have no problems using C# code; I just
asked
that initially because it's what I'm most familiar with. I've come
across
that class before, but the problem is that it requires the password of
the
user I'm mapping a network drive for. I was hoping there was some way I
could use IIS Windows Authentication or something similar to do this with
an
account that has administrative rights, so I wouldn't be required to know
the
user's password.
I posted this same question in the ASP.NET newsgroup -- it appears what I
would like to do isn't feasible without resorting to ActiveX. Thanks for
the
replies.
I kind of doubt that.

Jun 30 '08 #7

"Brian Nicholson" <Br************ @discussions.mi crosoft.comwrot e in
message news:24******** *************** ***********@mic rosoft.com...
"Mr. Arnold" wrote:
>>
As someone else said, you might not find a VB example, and as a good .Net
programmer, you need to know C# and VB. It's not that hard to translate.
There is no reason that you can't use the class for an ASP.Net solution.

There is also no reason you couldn't just take the class talked about as
is,
compile as a C# dll, and set reference to the DLL and use it in your VB
project.

http://www.codeproject.com/KB/system/mapnetdrive.aspx

Thank you for the response. I have no problems using C# code; I just
asked
that initially because it's what I'm most familiar with. I've come across
that class before, but the problem is that it requires the password of the
user I'm mapping a network drive for. I was hoping there was some way I
could use IIS Windows Authentication or something similar to do this with
an
account that has administrative rights, so I wouldn't be required to know
the
user's password.
I don't see why you couldn't use a generic user-id and psw that had admin
rights, but of course this application should never face the Internet.

Jun 30 '08 #8
"Mr. Arnold" wrote:
>
I don't see why you couldn't use a generic user-id and psw that had admin
rights, but of course this application should never face the Internet.

That's exactly what I would like to do, but I don't see how that could be
done with this class (or other methods I've found). If I were to supply an
admin username/password, it would map the drive to that admin user -- I want
to perform this task under an admin account, but the drive should actually be
mapped for another user.

As for doubting the impossibility of doing this without ActiveX, you might
be right -- I think the Microsoft MVP may have misunderstood what I was
trying to do.
Jun 30 '08 #9
"Brian Nicholson" wrote:
>
That's exactly what I would like to do, but I don't see how that could be
done with this class (or other methods I've found). If I were to supply an
admin username/password, it would map the drive to that admin user -- I want
to perform this task under an admin account, but the drive should actually be
mapped for another user.

As for doubting the impossibility of doing this without ActiveX, you might
be right -- I think the Microsoft MVP may have misunderstood what I was
trying to do.
Scratch that -- I originally thought that the username and password were for
the destination of the drive mapping, but it makes more sense that the
username and password is to simply supply credentials for mapping the drive
on the local computer. I guess my question then is how do I get this script
to execute on a specified computer other than the web server?
Jun 30 '08 #10

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

Similar topics

3
3649
by: Robert Tarantino | last post by:
Hello, I am trying to find a way to create a scheduled task or service that will copy my local profile folders under "Documents and settings" to a network drive. This would allow me to restore my settings if my profile became tampered with or corrupt. Is there any sample code available out there? -Robert
2
5805
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 a while the network drive apears to have a red X on the icon and the drive becomes disconnected. this seems to effect the VB code from grabbing the tables. I get an error saying the specific table cannot be found. If i manually open the mapped...
1
6569
by: brian.oneil2 | last post by:
Is there a way to install this onto a network file share and allow a team to access it? I would say share a CD from a networked CD drive, but there are multiple CD's that would have to be inserted. TIA, Brian
8
11848
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, and use @"C:\file.txt"; it worked Thanks a lot
5
4474
by: Nirosh | last post by:
Hi All, Can any one suggest me a best way to do this .. I have a thrid party tool "EXE" that we need to use with our web service to manipulate some complex XML files, which reside in a seperate files server. we have mapped the fodler to a different folder and need to allow the EXE to process on the mapped drive. When I trigger the EXE via web service the EXE get the permission of the launching user (mean ASP.NET user) resulting a...
3
10582
by: James N | last post by:
My ASP.NET application needs read/write permissions for drive "Z:", which is mapped to my Linksys Gigadrive (Network Attached Storage...if anyone is familiar with that). If I configure the Gigadrive with "Guest" access rights, then everything works fine, BUT this leaves the drive vulnerable to everyone/everything including network viruses. Lately, my drive has had several attacks by the Lovegate virus. Eliminating such attacks...
2
2671
by: .Net Believer | last post by:
I using the routine below to copy file to a network drive for a regular backup process. Before calling this routine I using another function to check the presence of the LAN connection and the server where the network drive exists. Although of this check I am sometimes getting an exception (in 5% of times)saying "Could not find the U:\...\File.ext" or part of its path" Although the network dirve is available and accessible by windows...
1
2191
by: deiopajw | last post by:
I have a Back end database on a network drive. The copies of the front end are located on individual pc's (in their C drive). The problem arises when a laptop user naturally hooks up to the network but then the link from the front end (in the C drive of the laptop) to the back end (network drive) is lost. I have to then go to the tables section of the database window of the Front End and remove the links then link them again with the Back...
0
3230
by: Niyazi | last post by:
Hi, I created application that store the data in SQL SERVER that reside on network. The client also use this application to access the resources provided with application. But is the client want to register new customer or companies they will enter the information in Windows Form and the program automaticaly creates the WORD document under specific folder under application path. Once the empty word file created than ask user if they want...
0
1472
by: danasegarane | last post by:
Hi all I want to map a network drive. If the user has access to that site then that path will map automatically. If the user doesnt have any rights the i need to get the username and pwd from the user by using windows authentication screen. For example the WNetConnectionDialog shows the mapnetwork drive dialogbox.For example if you open an IE explorer and type the servername which you dont have access In the mean while I found...
0
8796
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8704
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9307
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9170
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9071
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7946
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6627
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5943
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
3
2105
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.