473,503 Members | 1,805 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I am stucked: Working on a network mapped drive via Web Service

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
permission issue. Mapped drive cannot access by the IIS (web application)
user.

I am keeping this open .. please advice me the best approach I can take here
to do this assuming that I cannot change the EXE or the mapped drive
requirements.

Thanks,
Regards,
Nirosh.

Nov 17 '05 #1
5 4445
Hi,

Either run the corresponding ASP .NET application in a dedicated application
pool running under a user account with sufficient permissions to access the
mapped network drive,

Or

Log in as such a user and impersonate for the time necessary to access the
mapped network drive. In this case, you'll need to grant elevated priveleges
to the ASPNET account ("Act as part of the operating system" if I'm not
mistaken).

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"Nirosh" <te**@test.lk> wrote in message
news:uK**************@TK2MSFTNGP12.phx.gbl...
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
permission issue. Mapped drive cannot access by the IIS (web application)
user.

I am keeping this open .. please advice me the best approach I can take
here
to do this assuming that I cannot change the EXE or the mapped drive
requirements.

Thanks,
Regards,
Nirosh.


Nov 17 '05 #2
Great suggestion Lapshyn,

Yes the first option is already evaluated and has decide as our long term
goal, and with your reply it cofirm that we are in the correct path.

But as the short term solution I like to go with the second option,
can you please give little more help on this
Log in as such a user and impersonate for the time necessary to access the
mean some thing like this in the web.config file
<identity impersonate="true"
userName="Wharton\tci"
password="pccd7972" />
mapped network drive. In this case, you'll need to grant elevated
priveleges to the ASPNET account ("Act as part of the operating system" if
I'm not mistaken).
What is this mean, I tried to google but I didn't get any clue? could you
provide me little more data..mean time I will try to find a path on this
line..

Thanks,
Nirosh.

"Dmytro Lapshyn [MVP]" <x-****@no-spam-please.hotpop.com> wrote in message
news:ug*************@tk2msftngp13.phx.gbl... Hi,

Either run the corresponding ASP .NET application in a dedicated
application pool running under a user account with sufficient permissions
to access the mapped network drive,

Or

Log in as such a user and impersonate for the time necessary to access the
mapped network drive. In this case, you'll need to grant elevated
priveleges to the ASPNET account ("Act as part of the operating system" if
I'm not mistaken).

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"Nirosh" <te**@test.lk> wrote in message
news:uK**************@TK2MSFTNGP12.phx.gbl...
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
permission issue. Mapped drive cannot access by the IIS (web application)
user.

I am keeping this open .. please advice me the best approach I can take
here
to do this assuming that I cannot change the EXE or the mapped drive
requirements.

Thanks,
Regards,
Nirosh.

Nov 17 '05 #3
Network sessions are (logon) session bound, that means that when you map a
drive in your interactive logon session, that network session cannot be
seen/used by another logon session.
Now IIS creates a logon session for asp.net using the process credentials
specified in your web.config file (the default being aspnet), and all
programs spawned from within asp.net will use the same credentials when
accessing network resources. Now aspnet has no network credentials, so you
will have to create a use record from within your webservice specifying the
local drive the Fileshare and user credentials with appropriate privileges
to that remote share.

The easiest way to do this is by issuing a "net use" command using the
Process.Start() method.
The following is a small sample that shows you how to map \\\\bob\\share to
a local drive z: using bobby's credentials (bob\bobby is the userid and
BobsPass it's password, note that bob can be a domain name or a machine
name, so here "bob" is the remote machine name and Bobby is a local user on
Bob).
ProcessStartInfo psi = new ProcessStartInfo();
psi.CreateNoWindow = true;
psi.WindowStyle = ProcessWindowStyle.Hidden;
psi.FileName = "cmd";
psi.Arguments = "/c net use z: \\\\bob\\share BobsPass /user:bob\\bobby";
Process proc = Process.Start(psi);
proc.WaitForExit();
if(proc.ExitCode != 0)
...

Note that you should also delete the mapping when done with it (using "net
use z: /delete"), I would also suggest you to map the drive for at least the
duration of the session and not for every webrequest
Note also that all this wouldn't have been necessary if the EXE had used UNC
paths instead of mapped drives, but I guess the EXE is written to only
access local drives.
Note that the options suggested by Dmytro don't work, the first make no
sense you'll need to map the drive anyway. the second method as suggested by
Dmytro, doesn't work either, the spawned exe will use the parent's process's
credentials NOT those of the impersonating thread.

Willy.
"Nirosh" <te**@test.lk> wrote in message
news:ON*****************@TK2MSFTNGP10.phx.gbl...
Great suggestion Lapshyn,

Yes the first option is already evaluated and has decide as our long term
goal, and with your reply it cofirm that we are in the correct path.

But as the short term solution I like to go with the second option,
can you please give little more help on this
Log in as such a user and impersonate for the time necessary to access
the


mean some thing like this in the web.config file
<identity impersonate="true"
userName="Wharton\tci"
password="pccd7972" />
mapped network drive. In this case, you'll need to grant elevated
priveleges to the ASPNET account ("Act as part of the operating system"
if I'm not mistaken).


What is this mean, I tried to google but I didn't get any clue? could you
provide me little more data..mean time I will try to find a path on this
line..

Thanks,
Nirosh.

"Dmytro Lapshyn [MVP]" <x-****@no-spam-please.hotpop.com> wrote in message
news:ug*************@tk2msftngp13.phx.gbl...
Hi,

Either run the corresponding ASP .NET application in a dedicated
application pool running under a user account with sufficient permissions
to access the mapped network drive,

Or

Log in as such a user and impersonate for the time necessary to access
the mapped network drive. In this case, you'll need to grant elevated
priveleges to the ASPNET account ("Act as part of the operating system"
if I'm not mistaken).

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"Nirosh" <te**@test.lk> wrote in message
news:uK**************@TK2MSFTNGP12.phx.gbl...
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
permission issue. Mapped drive cannot access by the IIS (web
application)
user.

I am keeping this open .. please advice me the best approach I can take
here
to do this assuming that I cannot change the EXE or the mapped drive
requirements.

Thanks,
Regards,
Nirosh.


Nov 17 '05 #4
there u go ... I see the light now.. I can take it on now.. thank you very
much for this..

I guess Argument has a typing mistake, for others the correction is bellow

psi.Arguments = "net use z: \\\\bob\\share BobsPass /user:bob\\bobby";

Nirosh.

"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:ex*************@tk2msftngp13.phx.gbl...
Network sessions are (logon) session bound, that means that when you map a
drive in your interactive logon session, that network session cannot be
seen/used by another logon session.
Now IIS creates a logon session for asp.net using the process credentials
specified in your web.config file (the default being aspnet), and all
programs spawned from within asp.net will use the same credentials when
accessing network resources. Now aspnet has no network credentials, so you
will have to create a use record from within your webservice specifying
the local drive the Fileshare and user credentials with appropriate
privileges to that remote share.

The easiest way to do this is by issuing a "net use" command using the
Process.Start() method.
The following is a small sample that shows you how to map \\\\bob\\share
to a local drive z: using bobby's credentials (bob\bobby is the userid and
BobsPass it's password, note that bob can be a domain name or a machine
name, so here "bob" is the remote machine name and Bobby is a local user
on Bob).
ProcessStartInfo psi = new ProcessStartInfo();
psi.CreateNoWindow = true;
psi.WindowStyle = ProcessWindowStyle.Hidden;
psi.FileName = "cmd";
psi.Arguments = "/c net use z: \\\\bob\\share BobsPass
/user:bob\\bobby";
Process proc = Process.Start(psi);
proc.WaitForExit();
if(proc.ExitCode != 0)
...

Note that you should also delete the mapping when done with it (using "net
use z: /delete"), I would also suggest you to map the drive for at least
the duration of the session and not for every webrequest
Note also that all this wouldn't have been necessary if the EXE had used
UNC paths instead of mapped drives, but I guess the EXE is written to only
access local drives.
Note that the options suggested by Dmytro don't work, the first make no
sense you'll need to map the drive anyway. the second method as suggested
by Dmytro, doesn't work either, the spawned exe will use the parent's
process's credentials NOT those of the impersonating thread.

Willy.
"Nirosh" <te**@test.lk> wrote in message
news:ON*****************@TK2MSFTNGP10.phx.gbl...
Great suggestion Lapshyn,

Yes the first option is already evaluated and has decide as our long term
goal, and with your reply it cofirm that we are in the correct path.

But as the short term solution I like to go with the second option,
can you please give little more help on this
Log in as such a user and impersonate for the time necessary to access
the


mean some thing like this in the web.config file
<identity impersonate="true"
userName="Wharton\tci"
password="pccd7972" />
mapped network drive. In this case, you'll need to grant elevated
priveleges to the ASPNET account ("Act as part of the operating system"
if I'm not mistaken).


What is this mean, I tried to google but I didn't get any clue? could you
provide me little more data..mean time I will try to find a path on this
line..

Thanks,
Nirosh.

"Dmytro Lapshyn [MVP]" <x-****@no-spam-please.hotpop.com> wrote in
message news:ug*************@tk2msftngp13.phx.gbl...
Hi,

Either run the corresponding ASP .NET application in a dedicated
application pool running under a user account with sufficient
permissions to access the mapped network drive,

Or

Log in as such a user and impersonate for the time necessary to access
the mapped network drive. In this case, you'll need to grant elevated
priveleges to the ASPNET account ("Act as part of the operating system"
if I'm not mistaken).

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"Nirosh" <te**@test.lk> wrote in message
news:uK**************@TK2MSFTNGP12.phx.gbl...
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
permission issue. Mapped drive cannot access by the IIS (web
application)
user.

I am keeping this open .. please advice me the best approach I can take
here
to do this assuming that I cannot change the EXE or the mapped drive
requirements.

Thanks,
Regards,
Nirosh.



Nov 17 '05 #5
If you mean by this that the /C is not required, I'm affraid you are wrong,
the /C option tells the cmd shell to exit when done executing the command,
without this option cmd.exe stays active.

Willy.
"Nirosh" <te**@test.lk> wrote in message
news:eX**************@TK2MSFTNGP12.phx.gbl...
there u go ... I see the light now.. I can take it on now.. thank you very
much for this..

I guess Argument has a typing mistake, for others the correction is bellow

psi.Arguments = "net use z: \\\\bob\\share BobsPass /user:bob\\bobby";

Nirosh.

"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:ex*************@tk2msftngp13.phx.gbl...
Network sessions are (logon) session bound, that means that when you map
a drive in your interactive logon session, that network session cannot be
seen/used by another logon session.
Now IIS creates a logon session for asp.net using the process credentials
specified in your web.config file (the default being aspnet), and all
programs spawned from within asp.net will use the same credentials when
accessing network resources. Now aspnet has no network credentials, so
you will have to create a use record from within your webservice
specifying the local drive the Fileshare and user credentials with
appropriate privileges to that remote share.

The easiest way to do this is by issuing a "net use" command using the
Process.Start() method.
The following is a small sample that shows you how to map \\\\bob\\share
to a local drive z: using bobby's credentials (bob\bobby is the userid
and BobsPass it's password, note that bob can be a domain name or a
machine name, so here "bob" is the remote machine name and Bobby is a
local user on Bob).
ProcessStartInfo psi = new ProcessStartInfo();
psi.CreateNoWindow = true;
psi.WindowStyle = ProcessWindowStyle.Hidden;
psi.FileName = "cmd";
psi.Arguments = "/c net use z: \\\\bob\\share BobsPass
/user:bob\\bobby";
Process proc = Process.Start(psi);
proc.WaitForExit();
if(proc.ExitCode != 0)
...

Note that you should also delete the mapping when done with it (using
"net use z: /delete"), I would also suggest you to map the drive for at
least the duration of the session and not for every webrequest
Note also that all this wouldn't have been necessary if the EXE had used
UNC paths instead of mapped drives, but I guess the EXE is written to
only access local drives.
Note that the options suggested by Dmytro don't work, the first make no
sense you'll need to map the drive anyway. the second method as suggested
by Dmytro, doesn't work either, the spawned exe will use the parent's
process's credentials NOT those of the impersonating thread.

Willy.
"Nirosh" <te**@test.lk> wrote in message
news:ON*****************@TK2MSFTNGP10.phx.gbl...
Great suggestion Lapshyn,

Yes the first option is already evaluated and has decide as our long
term goal, and with your reply it cofirm that we are in the correct
path.

But as the short term solution I like to go with the second option,
can you please give little more help on this

Log in as such a user and impersonate for the time necessary to access
the

mean some thing like this in the web.config file
<identity impersonate="true"
userName="Wharton\tci"
password="pccd7972" />

mapped network drive. In this case, you'll need to grant elevated
priveleges to the ASPNET account ("Act as part of the operating system"
if I'm not mistaken).

What is this mean, I tried to google but I didn't get any clue? could
you provide me little more data..mean time I will try to find a path on
this line..

Thanks,
Nirosh.

"Dmytro Lapshyn [MVP]" <x-****@no-spam-please.hotpop.com> wrote in
message news:ug*************@tk2msftngp13.phx.gbl...
Hi,

Either run the corresponding ASP .NET application in a dedicated
application pool running under a user account with sufficient
permissions to access the mapped network drive,

Or

Log in as such a user and impersonate for the time necessary to access
the mapped network drive. In this case, you'll need to grant elevated
priveleges to the ASPNET account ("Act as part of the operating system"
if I'm not mistaken).

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"Nirosh" <te**@test.lk> wrote in message
news:uK**************@TK2MSFTNGP12.phx.gbl...
> 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
> permission issue. Mapped drive cannot access by the IIS (web
> application)
> user.
>
> I am keeping this open .. please advice me the best approach I can
> take here
> to do this assuming that I cannot change the EXE or the mapped drive
> requirements.
>
> Thanks,
> Regards,
> Nirosh.
>
>
>



Nov 17 '05 #6

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

Similar topics

2
11111
by: AMD | last post by:
Hi, I would like to have MySQL use a mapped network drive. I'd like to do this in case there is a failure of the mysql machine, I can just replace it with a new machine pointing to the same...
6
9674
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...
1
2065
by: Tommy.Vincent | last post by:
Hi, When i use to work on Windows 2000 advance server and Sql 2000 I was able to do network restoration by using a mapped drive where my backup use to be lying.What i did was I assigned...
1
971
by: PeterNZ | last post by:
Hi all, I developped an C# app which is using FileSystemWatcher. If a file is created in a specific folder, it opens the file and does some processing. This functionality works without...
2
5767
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...
5
21537
by: Niloday | last post by:
Hi All, I am trying to access a mapped network drive from a service that I have created. The service needs to create/delete folders/files on a network drive. When I tried to connect to a...
1
3391
by: Max Baki via .NET 247 | last post by:
I all, i've write a sample ftp Windows service which download files and copy them on remote share or remote mapped drive (the service works fine on local drives). This part of code is the...
2
9521
by: Dave Stewart | last post by:
I am attempting to write a vb.net windows service that will automate various file movements on my network. When I attempt to access files on a mapped drive or UNC file share, I get exceptions...
2
2413
by: Michael | last post by:
We have an ASP.NET 2.0 web application running on a Windows 2003 domain controller. Part of that application needs to read and write files from and to a network share ( living on a MAC Xserveraid)...
0
7199
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
7074
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
7322
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...
1
6982
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
4667
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
3161
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
3150
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
374
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...

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.