WinForm not runs in network

  • Thread starter Thread starter Luigi
  • Start date Start date
L

Luigi

Hi all,
I have a simple WinForm (C# 2.0) that not works when I run the .exe file if
is placed in a network share folder.
If a run it in my machine, it works well.
The error that I receive (after accept debug mode) is placed in the row:

Application.CurrentCulture = new CultureInfo("it-IT");

and the error is of type:

{"Request for the permission of type
'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."}

How can I solve this problem?

Thanks in advance.
 
You need to understand .NET Code Access Security: CAS.

By default, any .NET code loaded from outside the running box is considered
unsafe and you need to configure the running computer's CAS to allow it to
run. With computer with .NET2.0 SDK installed (you developing box), you go
to Control Panel->Administrative Tools->MS .NET Framework 2.0 Configuration
to do that. With production computer, that configuration applet is not
available if the .NET 2.0 SDK is not installed (only the framework
installed), you need to use command line tool CASPOL.exe to do the security
configuration.

Searchinge net for CAS or CASPOL.exe would give tons of link to study on
this topic.

If you wna to make things simple, just build a installation package and
install your app locally. Or you can lok into ClickOnce for simplified
deployment.
 
Norman Yuan said:
You need to understand .NET Code Access Security: CAS.

By default, any .NET code loaded from outside the running box is considered
unsafe and you need to configure the running computer's CAS to allow it to
run. With computer with .NET2.0 SDK installed (you developing box), you go
to Control Panel->Administrative Tools->MS .NET Framework 2.0 Configuration
to do that. With production computer, that configuration applet is not
available if the .NET 2.0 SDK is not installed (only the framework
installed), you need to use command line tool CASPOL.exe to do the security
configuration.

Searchinge net for CAS or CASPOL.exe would give tons of link to study on
this topic.

If you wna to make things simple, just build a installation package and
install your app locally. Or you can lok into ClickOnce for simplified
deployment.

Thank you so much Norman, now I'll deep study this subject.

Luigi
 
Back
Top