By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,877 Members | 1,064 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,877 IT Pros & Developers. It's quick & easy.

Map network drive for user using VB/ASP.NET

P: n/a
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
Share this Question
Share on Google+
24 Replies


P: n/a
"Brian Nicholson" <Br************@discussions.microsoft.comwrote in
message news:3A**********************************@microsof t.com...
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?
Not natively through ASP.NET, for fairly obvious security reasons - remember
that web app cannot have any direct interaction with client machines due to
the disconnected architecture of the web...

To achieve this you'd need to look at something like a custom ActiveX
control - can't recommend it...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 29 '08 #2

P: n/a
If you get to Technet as well as elsewhere you will learn about PowerShell
which has become the optimal way to use the framework for administrative
tasks.
"Brian Nicholson" <Br************@discussions.microsoft.comwrote in
message news:3A**********************************@microsof t.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?

Thank you,
Brian Nicholson
Jun 29 '08 #3

P: n/a
"Junior" <so******@somewhere.comwrote in message
news:O0**************@TK2MSFTNGP05.phx.gbl...

[top-posting corrected]
>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?

If you get to Technet as well as elsewhere you will learn about PowerShell
which has become the optimal way to use the framework for administrative
tasks.
PowerShell won't allow a web app map a network drive via a client browser
without using ActiveX and seriously ramping down the security level - at
that point, you may as well not bother...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 29 '08 #4

P: n/a
"Mark Rae [MVP]" wrote:
>
Not natively through ASP.NET, for fairly obvious security reasons - remember
that web app cannot have any direct interaction with client machines due to
the disconnected architecture of the web...

To achieve this you'd need to look at something like a custom ActiveX
control - can't recommend it...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Forgive my ignorance as I am very new to ASP.NET, but what would be the
security problems of a web app that uses IIS with Integrated Windows
Authentication? Also, I thought that mapping network drives was a
user-specific task (not machine-specific) -- if that even makes a difference.

Thank you for your help.
Jun 30 '08 #5

P: n/a
"Brian Nicholson" <Br************@discussions.microsoft.comwrote in
message news:B0**********************************@microsof t.com...
>Not natively through ASP.NET, for fairly obvious security reasons -
remember
that web app cannot have any direct interaction with client machines due
to
the disconnected architecture of the web...

Forgive my ignorance as I am very new to ASP.NET, but what would be the
security problems of a web app that uses IIS with Integrated Windows
Authentication? Also, I thought that mapping network drives was a
user-specific task (not machine-specific) -- if that even makes a
difference.
It's not the web app per se - it's the browser. All modern browsers are
specifically designed to prevent *any* direct interaction with the user's
hardware other than for things like cookies etc. The fact that you're using
Windows authentication in an intranet environment is of no concern to the
browser, which is the same browser that you use to go out onto the public
Internet and do your on-line banking etc - the browser itself doesn't
understand the difference. All it knows how to do is send an HttpRequest to
a webserver and then process and display the HttpResponse which the
webserver streams back to it - makes no difference whether that webserver is
in your comms room or half-way round the world.

To give you a rather extreme example, imagine a web app which could stream
down an instruction to the client browser to run the equivalent of "format
c:" on the client machine...

Mapping a network drive involves direct interaction with the client machine
as far as the browser is concerned, so it's not permitted.
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 30 '08 #6

P: n/a
So you are the kind of guy who makes excuses rather than finding an
acceptable way to get things done?
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:ue**************@TK2MSFTNGP06.phx.gbl...
"Junior" <so******@somewhere.comwrote in message
news:O0**************@TK2MSFTNGP05.phx.gbl...

[top-posting corrected]
>>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?

If you get to Technet as well as elsewhere you will learn about
PowerShell which has become the optimal way to use the framework for
administrative tasks.

PowerShell won't allow a web app map a network drive via a client browser
without using ActiveX and seriously ramping down the security level - at
that point, you may as well not bother...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
Jun 30 '08 #7

P: n/a
"Mark Rae [MVP]" wrote:
>
It's not the web app per se - it's the browser. All modern browsers are
specifically designed to prevent *any* direct interaction with the user's
hardware other than for things like cookies etc. The fact that you're using
Windows authentication in an intranet environment is of no concern to the
browser, which is the same browser that you use to go out onto the public
Internet and do your on-line banking etc - the browser itself doesn't
understand the difference. All it knows how to do is send an HttpRequest to
a webserver and then process and display the HttpResponse which the
webserver streams back to it - makes no difference whether that webserver is
in your comms room or half-way round the world.

To give you a rather extreme example, imagine a web app which could stream
down an instruction to the client browser to run the equivalent of "format
c:" on the client machine...

Mapping a network drive involves direct interaction with the client machine
as far as the browser is concerned, so it's not permitted.
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

I kind of understand what you're saying, but I didn't think I was using the
browser itself as a means to perform the task -- I don't want the drive to be
mapped on the client computer that's actually going to the web app. I was
considering something like an admin page where the admin could enter certain
things like a network path, username, etc., and the app would use these
values in a VB script which could then perform the function (as if we weren't
using a web app to begin with), e.g. using something similar to VBScript's
MapNetworkDrive.

I apologize if you knew this already and I misunderstood your post.
Jun 30 '08 #8

P: n/a
PowerShell
"Brian Nicholson" <Br************@discussions.microsoft.comwrote in
message news:E6**********************************@microsof t.com...
"Mark Rae [MVP]" wrote:
>>
It's not the web app per se - it's the browser. All modern browsers are
specifically designed to prevent *any* direct interaction with the user's
hardware other than for things like cookies etc. The fact that you're
using
Windows authentication in an intranet environment is of no concern to the
browser, which is the same browser that you use to go out onto the public
Internet and do your on-line banking etc - the browser itself doesn't
understand the difference. All it knows how to do is send an HttpRequest
to
a webserver and then process and display the HttpResponse which the
webserver streams back to it - makes no difference whether that webserver
is
in your comms room or half-way round the world.

To give you a rather extreme example, imagine a web app which could
stream
down an instruction to the client browser to run the equivalent of
"format
c:" on the client machine...

Mapping a network drive involves direct interaction with the client
machine
as far as the browser is concerned, so it's not permitted.
--
Mark Rae
ASP.NET MVP
http://www.markrae.net


I kind of understand what you're saying, but I didn't think I was using
the
browser itself as a means to perform the task -- I don't want the drive to
be
mapped on the client computer that's actually going to the web app. I was
considering something like an admin page where the admin could enter
certain
things like a network path, username, etc., and the app would use these
values in a VB script which could then perform the function (as if we
weren't
using a web app to begin with), e.g. using something similar to VBScript's
MapNetworkDrive.

I apologize if you knew this already and I misunderstood your post.
Jun 30 '08 #9

P: n/a
"Junior" wrote:
>
PowerShell
I have no experience at all with PowerShell (I have very little experience
with ASP.NET as it is), but if it's able to do this through ASP.NET then I'm
interested. Do you happen to know how it can be done? After a quick search,
I found articles mentioning the same MapNetworkDrive that exists in VBScript
-- the problem with this method is that it requires the password of the user
I'm mapping a drive to.
Jun 30 '08 #10

P: n/a
"Junior" <so******@somewhere.comwrote in message
news:uX**************@TK2MSFTNGP02.phx.gbl...

[top-posting corrected again]
>>>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?

If you get to Technet as well as elsewhere you will learn about
PowerShell which has become the optimal way to use the framework for
administrative tasks.

PowerShell won't allow a web app map a network drive via a client browser
without using ActiveX and seriously ramping down the security level - at
that point, you may as well not bother...

So you are the kind of guy who makes excuses rather than finding an
acceptable way to get things done?
Go on, then, I'll bite...

Please demonstrate how you can use PowerShell via an ASP.NET web app to map
a network drive on the client machine...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 30 '08 #11

P: n/a
"Brian Nicholson" <Br************@discussions.microsoft.comwrote in
message news:E6**********************************@microsof t.com...
I kind of understand what you're saying, but I didn't think I was using
the
browser itself as a means to perform the task -- I don't want the drive to
be
mapped on the client computer that's actually going to the web app. I was
considering something like an admin page where the admin could enter
certain
things like a network path, username, etc., and the app would use these
values in a VB script which could then perform the function (as if we
weren't
using a web app to begin with), e.g. using something similar to VBScript's
MapNetworkDrive.
Please clarify on which machine you intend to map a network drive: the
client machine, the web server or a different machine altogether...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 30 '08 #12

P: n/a


"Mark Rae [MVP]" wrote:
"Brian Nicholson" <Br************@discussions.microsoft.comwrote in
message news:E6**********************************@microsof t.com...
I kind of understand what you're saying, but I didn't think I was using
the
browser itself as a means to perform the task -- I don't want the drive to
be
mapped on the client computer that's actually going to the web app. I was
considering something like an admin page where the admin could enter
certain
things like a network path, username, etc., and the app would use these
values in a VB script which could then perform the function (as if we
weren't
using a web app to begin with), e.g. using something similar to VBScript's
MapNetworkDrive.

Please clarify on which machine you intend to map a network drive: the
client machine, the web server or a different machine altogether...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

From my understanding of mapped network drives, they're done per user; the
drives aren't mapped on the actual machine. If by which machine I intend to
use to map it you meant the machine that will do the actual mapping, I
suppose the web server will do that. Basically, I want to be able to use
administrative rights over some web application that allows me to map a
network folder to a drive for a specified user.
Jun 30 '08 #13

P: n/a
"Brian Nicholson" <Br************@discussions.microsoft.comwrote in
message news:EF**********************************@microsof t.com...
From my understanding of mapped network drives, they're done per user; the
drives aren't mapped on the actual machine. If by which machine I intend
to
use to map it you meant the machine that will do the actual mapping, I
suppose the web server will do that. Basically, I want to be able to use
administrative rights over some web application that allows me to map a
network folder to a drive for a specified user.

I wonder if we are we getting bogged down in nomenclature here...?

The term "mapped network drive" means, to me at least, that there is a share
(usually a folder on a remote fileserver) something like
\\fileserver\sharedfiles\Mark which I want to access as if it were a local
drive on my machine. So I map a drive letter to it, e.g. P:\, which then
appears in Windows Explorer...

This means that I can then refer to files stored on the remote share using
the syntax e.g. P:\MyDocument.docx rather than having to type
\\fileserver\sharedfiles\Mark\MyDocument.docx

Is that what you mean?

If so, then the mapped drive is on my machine...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 30 '08 #14

P: n/a
it sounds like you are trying to update the users profile and maybe the login
script. this can be done if the web site appdomin runs as a network admin or
you use kerberos and an admin logs on. see the wmi library for the routines.
you will need to switch to a nt admin forum to learn how to use wmi.

-- bruce (sqlwork.com)
"Brian Nicholson" wrote:
>

"Mark Rae [MVP]" wrote:
"Brian Nicholson" <Br************@discussions.microsoft.comwrote in
message news:E6**********************************@microsof t.com...
I kind of understand what you're saying, but I didn't think I was using
the
browser itself as a means to perform the task -- I don't want the drive to
be
mapped on the client computer that's actually going to the web app. I was
considering something like an admin page where the admin could enter
certain
things like a network path, username, etc., and the app would use these
values in a VB script which could then perform the function (as if we
weren't
using a web app to begin with), e.g. using something similar to VBScript's
MapNetworkDrive.
Please clarify on which machine you intend to map a network drive: the
client machine, the web server or a different machine altogether...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

From my understanding of mapped network drives, they're done per user; the
drives aren't mapped on the actual machine. If by which machine I intend to
use to map it you meant the machine that will do the actual mapping, I
suppose the web server will do that. Basically, I want to be able to use
administrative rights over some web application that allows me to map a
network folder to a drive for a specified user.
Jun 30 '08 #15

P: n/a
while powershell is a handy for creating admin scripts, spawing a powershell
script to perform admin operations from a website is a pretty sketchy
programming practice, sign of a true hack.

if asp.net ever supports powershell as a language, then this might make
sense, but currently perl (which asp.net supports) would be a better choice
if you wanted to use an admin scripting language.

-- bruce (sqlwork.com)
"Junior" wrote:
If you get to Technet as well as elsewhere you will learn about PowerShell
which has become the optimal way to use the framework for administrative
tasks.
"Brian Nicholson" <Br************@discussions.microsoft.comwrote in
message news:3A**********************************@microsof t.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?

Thank you,
Brian Nicholson

Jun 30 '08 #16

P: n/a
"Mark Rae [MVP]" wrote:
"Brian Nicholson" <Br************@discussions.microsoft.comwrote in
message news:EF**********************************@microsof t.com...
From my understanding of mapped network drives, they're done per user; the
drives aren't mapped on the actual machine. If by which machine I intend
to
use to map it you meant the machine that will do the actual mapping, I
suppose the web server will do that. Basically, I want to be able to use
administrative rights over some web application that allows me to map a
network folder to a drive for a specified user.


I wonder if we are we getting bogged down in nomenclature here...?

The term "mapped network drive" means, to me at least, that there is a share
(usually a folder on a remote fileserver) something like
\\fileserver\sharedfiles\Mark which I want to access as if it were a local
drive on my machine. So I map a drive letter to it, e.g. P:\, which then
appears in Windows Explorer...

This means that I can then refer to files stored on the remote share using
the syntax e.g. P:\MyDocument.docx rather than having to type
\\fileserver\sharedfiles\Mark\MyDocument.docx

Is that what you mean?

If so, then the mapped drive is on my machine...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

All right, I apologize -- the example I was thinking of was NET USE, which
takes a domain\username as a parameter rather than the computer name, but I
guess it finds the computer that the specified user is on and makes the
changes there. In any case, in response to your question, I was referring to
a different computer altogether.
Jun 30 '08 #17

P: n/a
"Brian Nicholson" <Br************@discussions.microsoft.comwrote in
message news:8A**********************************@microsof t.com...
All right, I apologize -- the example I was thinking of was NET USE, which
takes a domain\username as a parameter rather than the computer name, but
I
guess it finds the computer that the specified user is on and makes the
changes there. In any case, in response to your question, I was referring
to
a different computer altogether.
Hmm - I don't believe this is correct.

As I understand it, the domain\username parameter is used to specify the
credentials under which the NET USE command will run - the network drive
will still be mapped on the machine on which the NET USE command is being
issued...

E.g. an "ordinary" domain user might not have sufficient privileges to map a
network drive due to policies etc, but a domain admin can pop a command
prompt and issue the NET USE command by supplying his domain admin
credentials...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 30 '08 #18

P: n/a
"Mark Rae [MVP]" wrote:
Hmm - I don't believe this is correct.

As I understand it, the domain\username parameter is used to specify the
credentials under which the NET USE command will run - the network drive
will still be mapped on the machine on which the NET USE command is being
issued...

E.g. an "ordinary" domain user might not have sufficient privileges to map a
network drive due to policies etc, but a domain admin can pop a command
prompt and issue the NET USE command by supplying his domain admin
credentials...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Ah okay...that would make more sense then.
Jun 30 '08 #19

P: n/a
"bruce barker" wrote:
it sounds like you are trying to update the users profile and maybe the login
script. this can be done if the web site appdomin runs as a network admin or
you use kerberos and an admin logs on. see the wmi library for the routines.
you will need to switch to a nt admin forum to learn how to use wmi.

-- bruce (sqlwork.com)
Thanks for the tips...I'll see what I can do with WMI.
Jun 30 '08 #20

P: n/a
Seen a similar discussion in the vb group. Please avoid multiposting as it
creates two independent threads that could waste our time (we have no idea
what is going on on the other side).... If you really have to, please
crosspost instead (i.e. post the *same* message to two groups) so that we
have a *single* discussion about the issue you raised....

--
Patrice

"Brian Nicholson" <Br************@discussions.microsoft.coma écrit dans le
message de groupe de discussion :
38**********************************@microsoft.com...
"bruce barker" wrote:
>it sounds like you are trying to update the users profile and maybe the
login
script. this can be done if the web site appdomin runs as a network admin
or
you use kerberos and an admin logs on. see the wmi library for the
routines.
you will need to switch to a nt admin forum to learn how to use wmi.

-- bruce (sqlwork.com)

Thanks for the tips...I'll see what I can do with WMI.

Jun 30 '08 #21

P: n/a
All right -- I'll admit that I've never used newsgroups previously to post my
questions and I am unaware of the conventions. I apologize for the
inconvenience.

"Patrice" wrote:
Seen a similar discussion in the vb group. Please avoid multiposting as it
creates two independent threads that could waste our time (we have no idea
what is going on on the other side).... If you really have to, please
crosspost instead (i.e. post the *same* message to two groups) so that we
have a *single* discussion about the issue you raised....

--
Patrice

"Brian Nicholson" <Br************@discussions.microsoft.coma crit dans le
message de groupe de discussion :
38**********************************@microsoft.com...
"bruce barker" wrote:
it sounds like you are trying to update the users profile and maybe the
login
script. this can be done if the web site appdomin runs as a network admin
or
you use kerberos and an admin logs on. see the wmi library for the
routines.
you will need to switch to a nt admin forum to learn how to use wmi.

-- bruce (sqlwork.com)
Thanks for the tips...I'll see what I can do with WMI.

Jun 30 '08 #22

P: n/a
PowerShell is Microsoft's newest approach to system administration and is
meant to supercede the cmd shell and VBScript both of which remain present
but are lame in comparison. PowerShell requires .NET 2.0 as it uses the
classes from the framework.

To others in this topic I do not say that PowerShell commands (cmdlet) run
through the browser but IMO should be learned by anybody who has system
administration responsibilities. Visual tools to use PowerShell are
available but need to mature.

Technet Magazine and http://technet.com is where a lot can be learned and a
quick look can be gained using the site filter

//search
powershell site:technet.com
"Brian Nicholson" <Br************@discussions.microsoft.comwrote in
message news:B0**********************************@microsof t.com...
All right -- I'll admit that I've never used newsgroups previously to post
my
questions and I am unaware of the conventions. I apologize for the
inconvenience.

"Patrice" wrote:
>Seen a similar discussion in the vb group. Please avoid multiposting as
it
creates two independent threads that could waste our time (we have no
idea
what is going on on the other side).... If you really have to, please
crosspost instead (i.e. post the *same* message to two groups) so that we
have a *single* discussion about the issue you raised....

--
Patrice

"Brian Nicholson" <Br************@discussions.microsoft.coma crit dans
le
message de groupe de discussion :
38**********************************@microsoft.com...
"bruce barker" wrote:

it sounds like you are trying to update the users profile and maybe
the
login
script. this can be done if the web site appdomin runs as a network
admin
or
you use kerberos and an admin logs on. see the wmi library for the
routines.
you will need to switch to a nt admin forum to learn how to use wmi.

-- bruce (sqlwork.com)
Thanks for the tips...I'll see what I can do with WMI.

Jun 30 '08 #23

P: n/a
Hello Junior,

I issue powershell commands all day long through aspx pages for Exchange
Recipient tasks.

Well, OK, our service desk does, using pages I created.

Depending on what the OP really wants, he could use powershell to modify
a user object in AD, or vbscript which he might be more familier with.
PowerShell is Microsoft's newest approach to system administration and
is meant to supercede the cmd shell and VBScript both of which remain
present but are lame in comparison. PowerShell requires .NET 2.0 as it
uses the classes from the framework.

To others in this topic I do not say that PowerShell commands (cmdlet)
run through the browser but IMO should be learned by anybody who has
system administration responsibilities. Visual tools to use PowerShell
are available but need to mature.

Technet Magazine and http://technet.com is where a lot can be learned
and a quick look can be gained using the site filter

//search

powershell site:technet.com

Jul 1 '08 #24

P: n/a
I am looking to map a network drive on the CLIENT machine. Our plan is to have the user connect to VPN, then go to a web page, click a button & map network drives (i.e. p: \\servername\public). So, ultimately, the CLIENT machine has the drive showing up under 'My Computer.' Does PowerShell allow this to occur? thansk.
Oct 3 '08 #25

This discussion thread is closed

Replies have been disabled for this discussion.