1
Answer

HELP!!! System.Security.SecurityException ERROR (C#)

Mahmoud Hassan

Mahmoud Hassan

17y
7.4k
1
HI ALL

PLEASE HELP ME. I am stuck on this point and can't do any progress in my project.

Currently, I am using Domain Environment. I have Active directory and I want every users when they login to the domain, a program (.exe) file will run on there machines.

This as you know, can be done by configuring logon script through GROUP POLICY ( from active directoty).

Any how, when I run the (.exe) file generated when compiling the code in my local machine ( THE server that host the active directory), it works well.

BUT, when the users try to login and run (.exe) file the follwing error generated:

************************************************** **********************************

System.Security.SecurityException: Request for the permission of type'System.Security.Permissions.SeurityPermission ,
mscorlib, Version=2.0.0., Culture=neural, PublicToken=b77a5c561934e089' failed


at System.Security.Principal.WindwosIdentity.GetCurre nt()

at TestConnection.Program.Main(Straing []args)

The action that failed was:

Demand

The type of the first permission failed was:

System.Security.Permissions.SecurityPermission


The zone of the assembly that failed was:

Internet


************************************************** *********************************

As you can see from the execption. when I use the method WindowsIdentity.getCurrent()


it fails why? Howover, when I use any symbol method only let's say " Console.WriteLine() >> this will work.


I found something intersting about changing the security of the project by browsing to the solution explorer then open the PROJECT PROPERTIES

THEN YOU GO TO SECURITY.

But I couldn't understand how to change the security of my code to make it run in any PCs requesting it from the Server.

I think the whole problem is a permission problem?? SO PLZ HOW TO SOLVE IT
Answers (1)