473,581 Members | 2,233 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 4456
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******** ******@TK2MSFTN GP12.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="tr ue"
userName="Whart on\tci"
password="pccd7 972" />
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.c om> wrote in message
news:ug******** *****@tk2msftng p13.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******** ******@TK2MSFTN GP12.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).
ProcessStartInf o psi = new ProcessStartInf o();
psi.CreateNoWin dow = true;
psi.WindowStyle = ProcessWindowSt yle.Hidden;
psi.FileName = "cmd";
psi.Arguments = "/c net use z: \\\\bob\\share BobsPass /user:bob\\bobby ";
Process proc = Process.Start(p si);
proc.WaitForExi t();
if(proc.ExitCod e != 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******** *********@TK2MS FTNGP10.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="tr ue"
userName="Whart on\tci"
password="pccd7 972" />
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.c om> wrote in message
news:ug******** *****@tk2msftng p13.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******** ******@TK2MSFTN GP12.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******** *****@tk2msftng p13.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).
ProcessStartInf o psi = new ProcessStartInf o();
psi.CreateNoWin dow = true;
psi.WindowStyle = ProcessWindowSt yle.Hidden;
psi.FileName = "cmd";
psi.Arguments = "/c net use z: \\\\bob\\share BobsPass
/user:bob\\bobby ";
Process proc = Process.Start(p si);
proc.WaitForExi t();
if(proc.ExitCod e != 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******** *********@TK2MS FTNGP10.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="tr ue"
userName="Whart on\tci"
password="pccd7 972" />
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.c om> wrote in
message news:ug******** *****@tk2msftng p13.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******** ******@TK2MSFTN GP12.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******** ******@TK2MSFTN GP12.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******** *****@tk2msftng p13.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).
ProcessStartInf o psi = new ProcessStartInf o();
psi.CreateNoWin dow = true;
psi.WindowStyle = ProcessWindowSt yle.Hidden;
psi.FileName = "cmd";
psi.Arguments = "/c net use z: \\\\bob\\share BobsPass
/user:bob\\bobby ";
Process proc = Process.Start(p si);
proc.WaitForExi t();
if(proc.ExitCod e != 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******** *********@TK2MS FTNGP10.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="tr ue"
userName="Whart on\tci"
password="pccd7 972" />

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.c om> wrote in
message news:ug******** *****@tk2msftng p13.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******** ******@TK2MSFTN GP12.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
11157
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 network drive. Is this possible at all? Thanks, Andre M. Descombes
6
9697
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 10:24:48 AM run() error: System.IO.IOException: The specified network password is not correct. at System.IO.__Error.WinIOError(Int32 errorCode,...
1
2080
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 administrator rights to my login and in Services (mssqlserver)i added my login. Then I was able to access any mapped drive from my network in Sql server...
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 problems in the following scenarios: In a Winform App, pointing at a Local Folder In a Winform App, pointing at a mapped network Folder In a Winform App,...
2
5784
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...
5
21552
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 folder on mapped network drive (eg. N:\Storage that corresponds to \\FS1NS\SharedDir\), I get an error as "Could not find part of path N:\".
1
3400
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 function to change the local path for downloaded files. If the configured path is different from local drive C: the new path is selected. The program...
2
9523
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 claiming that the file is not there. However if I copy the file path directly in to explorer it pops right up. I know that my service is running as...
2
2415
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) on the same network segment. I mapped a drive on the server to that share. When mapping the drive, I could enter access credentials for the shares...
0
7868
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...
0
8149
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. ...
0
8304
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...
1
7899
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...
0
8175
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5674
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...
0
3805
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1138
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...

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.