Security Policy

  • Thread starter Thread starter Tim Bücker
  • Start date Start date
T

Tim Bücker

Hello.

I have written a little program that uses some unmanaged code -
[DllImport("....dll")].
I´ve send this program to a friend of mine and now he gets a security error.

Two questions about that:

1)
How can I test my application for security errors?
Because I can´t reproduce this error it is very hard to get rid of it...

2)
What do I have to do to get the code running?
I think I remember something like creating a strong name key and enter that
key in the assembly file.
Unfortunately I don´t remember much more...

Any help, links or tips?
Thanks a lot in advance!

Greetings,
Tim.
 
Tim Bücker said:
Hello.

I have written a little program that uses some unmanaged code -
[DllImport("....dll")].
I´ve send this program to a friend of mine and now he gets a security
error.

Could you post the exact exception message?

Willy.
 
Willy Denoyette said:
I have written a little program that uses some unmanaged code -
[DllImport("....dll")].
I´ve send this program to a friend of mine and now he gets a security
error.

Could you post the exact exception message?

Sorry, no. I´ve no contact with my friend at the moment. That was the reason
for my first questin - how can I test a security based problem?
But I think that it has to do something with this unmanaged code and shared
assemblies...

Thanks for answering!
Greetings, Tim.
 
Hard to tell without knowing the exact security error message, one
possibility is that your friend loads this from a network share, but it
could also relate to the unmanaged code that requires security privileges
not held by the user running the code.

Willy.

Tim Bücker said:
Newsbeitrag
I have written a little program that uses some unmanaged code -
[DllImport("....dll")].
I´ve send this program to a friend of mine and now he gets a security
error.

Could you post the exact exception message?

Sorry, no. I´ve no contact with my friend at the moment. That was the
reason
for my first questin - how can I test a security based problem?
But I think that it has to do something with this unmanaged code and
shared
assemblies...

Thanks for answering!
Greetings, Tim.
 
Willy Denoyette said:
Hard to tell without knowing the exact security error message, one
possibility is that your friend loads this from a network share

Loading the program from a network share I get a
"System.Security.Permissions.FileIOPermission, mscorlib, ..." exception
opening a OpenFileDialog.
So how is it done to allow the program being executed from a network share?

Thanks a lot!
Tim.
 
Tim Bücker said:
Newsbeitrag


Loading the program from a network share I get a
"System.Security.Permissions.FileIOPermission, mscorlib, ..." exception
opening a OpenFileDialog.
So how is it done to allow the program being executed from a network
share?

Thanks a lot!
Tim.
I see this is a Code Access Permission error, code loaded from a network
share (local intranet zone) has no FileIOPermission.
The Framework provides the .NET Framework Configuration Management Console
(Mscorcfg.msc) or a command line batch utility Caspol.exe to alter the
currently defined security policy.
For example, using Caspol.exe the following command enables FullTrust
permissions to the share (Full access to all resources):

caspol -machine -addgroup 1. -url \\server\share\* Fulltrust

You should take a look at
http://msdn.microsoft.com/library/d...fcodeaccesssecuritypolicyutilitycaspolexe.asp
for details about Code access security in .NET.

Willy.
 
Willy Denoyette said:
I see this is a Code Access Permission error, code loaded from a network
share (local intranet zone) has no FileIOPermission.
The Framework provides the .NET Framework Configuration Management Console
(Mscorcfg.msc) or a command line batch utility Caspol.exe to alter the
currently defined security policy.
For example, using Caspol.exe the following command enables FullTrust
permissions to the share (Full access to all resources):

caspol -machine -addgroup 1. -url \\server\share\* Fulltrust

You should take a look at
http://msdn.microsoft.com/library/d...fcodeaccesssecuritypolicyutilitycaspolexe.asp
for details about Code access security in .NET.

Thanks! I think that´s it!
And this security policy has to be altered on every computer I want to run
the software, right?

Thanks a lot for your help!
Greetings,
Tim.
 
Thanks! I think that´s it!
And this security policy has to be altered on every computer I want to run
the software, right?
That's right, on every computer loading assemblies from the intranet (file
shares).

Willy.
 
Back
Top