2

Duplicate:

Why does my .NET application crash when run from a network drive?


Can someone help me? For a school project, I wrote a C# windows application in Visual Studio 2005. It works just fine, no problems. I want to be able to share this program with others in my department at work. So, I copied the exe file to a network drive. When we attempt to run the exe from the network, it fails with "name of progrm...has encountered a problem and needs to close". If I have the co-worker copy the exe file to their c:\ drive then attempt to run, it works. Why won't my program run from the network drive?

Susan

Community
  • 1
  • 1

2 Answers2

14

.NET by default does not allow applications to be run off a network drive. Either copy it to a local drive or alter the security settings for .NET.

This discussion should give you what you need.

Community
  • 1
  • 1
Fredrik Mörk
  • 155,851
  • 29
  • 291
  • 343
3

Microsoft has finally realised that the default behavior of preventing applications from running off a network drive is wrong. From The .NET 3.5 SP1 download page:

"Additionally, managed applications that are opened from network shares have the same behavior as native applications by running with full trust."

This change is long overdue: there is virtually no security benefit in preventing managed applications running from a network share, since a hacker could just as easily use an unmanaged application.

Joe
  • 122,218
  • 32
  • 205
  • 338