Launching C# .EXE from Network Drive

D

dm3281

Hello, everyone.

I'm trying to launch a C# .EXE program from a networked drive using Vista.

I'm getting an exception (I don't remember the exact... something like
access denied or security).

The .EXE is simply a command line program using .NET 2.0 that opens an XML
file and pulls out a message and displays a msgbox. It then closes. The
..EXE reads an .XML file.

If I copy the .EXE and .XML file to my local PC and launch it, it works
fine.

Is there anything I need to do to allow this to work remotely?

Is this a .NET 2.0 security feature or a windows security future?

How do I disable or allow?
 
A

Andrew McLaren

dm3281 said:
I'm trying to launch a C# .EXE program from a networked drive using Vista.
I'm getting an exception (I don't remember the exact... something like If
I copy the .EXE and .XML file to my local PC and launch it, it works fine.
Is there anything I need to do to allow this to work remotely?
Is this a .NET 2.0 security feature or a windows security future?

Hi,

This is a .NET security feature.

..NET applications run with "Code Access Security" or CAS - this is a layer
of security, over and above what Windows provides.

CAS distinguishes between EXEs run on the relatively secure local machine,
and EXEs run from the rather less secure network share. By default, code on
a share will run with the security level of LocalIntranet - a lower level of
privilege than if it is run on the local drive.

To run the EXE from a network location, you can use the CASPOL.EXE utility
in .NET to configure a machine policy, to fully trust the network share.
Once this policy is in place, the EXE will run from the share, the same as
if it was on the local hard disk. You can probably configure an equivalent
setting in the application's manifest, but the exact syntax escapes me at
the moment.

Search for ("caspol" and "LocalIntranet") in the .NET SDK, or on Google, to
find lots of info about Code Access Security in .NET.

Hope it helps,
 
D

dm3281

Is CASPOL.EXE on all machines with .NET installed? I'm trying to launch on
Vista Ultimate and it appears not to be found??
 
A

Andrew McLaren

dm3281 said:
Is CASPOL.EXE on all machines with .NET installed? I'm trying to launch
on Vista Ultimate and it appears not to be found??

It ships as part of the .NET SDK. It's not included in the .NET
Redistributable, which is what end-users will have installed on their
machines. But you can copy the EXE from a developer machine to the end-user
machine, and run it there.

For more info on CASPOL, see:
http://msdn2.microsoft.com/en-us/library/cb6t8dtz(VS.80).aspx

..NET Framework SDK can be downloaded from here:
http://msdn2.microsoft.com/en-au/netframework/aa569263.aspx

This is a .NET issue. It's not really related to Vista, as such. For
assistance using CASPOL ... well, your best bet will be to talk to the
developer of the .NET EXE, and see what he/she thinks is the best solution:
caspol, manifest, or NET Framework Configuration tool (mscorcfg.msc).
Security in .NET can be a huge and complex topic; simple answers from
newsgroups could be misleading or misguided. But for newsgroup help, you'll
get better info by asking in a group like microsoft.public.dotnet.general.

Good luck with it,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top