ghiboz
ghiboz

Reputation: 8003

c# launch .exe from a remote folder

I made a .exe program in c# and locally works fine... but if I put the .exe into a remote path, when I launch, it gives error.. I use framework 2.0 how can I solve this?

thanks

edit: this is the error: alt text

and if I launch the program locally, it works fine ( I copied all the folder with directories...)

Upvotes: 1

Views: 574

Answers (2)

Marc Gravell
Marc Gravell

Reputation: 1064234

That is "code access security"; a random network share has very little trust from the core engine by default. With 2.0, your options are:

  • use a ClickOnce instead (execute the .application, not the .exe)
  • use caspol.exe (on every client) to tell it to trust the share
  • don't deploy that way (i.e. use an installer)

With some of the later service packs (it might be SP 2, I can't remember), mapped shares get more trust, i.e. \\server\share won't have enough trust by default, but h: (which is mapped to \\server\share) will run.

My preference would be the ClickOnce deployment since it works on all versions.

Upvotes: 6

Dirk Vollmar
Dirk Vollmar

Reputation: 176269

If feasible, upgrade to .NET 3.5 SP1. This .NET Framework version will allow you to start executables off a network share:

.NET Framework 3.5 SP1 Allows managed code to be launched from a network share!

Upvotes: 2

Related Questions