Two Security Exceptions

  • Thread starter Thread starter Diego F.
  • Start date Start date
D

Diego F.

I'm really stuck with this. I have to export a pdf file and I'm using a dll
(gios if someone knows it).

If I run this in a local project it's ok but when moving it to a server, I
get a Security.Exception:

- If I try to send via http: "that assembly does not allow partially trusted
callers"
- If I try to save to disk: "request for the permission type
'System.Security.Permissions.FileIOPermission'

In both cases the message suggests changing the application's trust levels.
How can I do that?
 
It sounds like your asp.net application is configured to run in a low trust
environment. For this:
- If I try to send via http: "that assembly does not allow partially
trusted callers"

Since your ASP.NET code is not fully trusted (it's partially trusted) and
you're calling into this strongly named assembly, this is a potential security
risk and thus isn't allowed. So either make your asp.net app fully trusted
again (potential security risk) or mark this target assembly with the AllowPartiallyTrustedCallers
attribute (again, potential security risk unless you've done a security code
review). I don't know what your host setup is and what your tolerance for
this is.
- If I try to save to disk: "request for the permission type
'System.Security.Permissions.FileIOPermission'

Again, your code is has not been granted the permission to write to the filesystem.
You'd need to grant it the permission to do so.
In both cases the message suggests changing the application's trust
levels. How can I do that?

These are the docs for configuring the trust level:

http://msdn2.microsoft.com/library/wyts434y(en-us,vs.80).aspx

But if you're on a hosted machine then I bet the admin is locking you down
and not allowing your code to run in a more trusted environment.

-Brock
DevelopMentor
http://staff.develop.com/ballen
 
Back
Top