We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Network Security Error

I am getting the following error when trying to run my project, which I know is generic and probably not a direct issue with Aspose.Network, but I have tried the commonly suggested workarounds without success. The is thrown a new instance of SMTPClient is created:

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

My project is a DLL. When running from a console test app it works fine. In my production app, the DLL that embeds the Aspose.Network code is called by another DLL that is called from a Web Service. I have tried using both the .net 2 and .net 3.5 builds of the assembly without success. I have tried giving a code group full permissions with both URL and Strong Name membership conditions. Neither had any impact.

Any thoughts?

Hello,

1. Could you please print out the exception.ToString() for our trouble shotting?

2. What's your code calling the aspose.network?

Thanks

Below is the error, which acutally gives me more info than I thought I had. It seems like Aspose.Network is running in the Internet Zone. Maybe it is the Aspose Assembly and not mine that needs to be added to a more trusted zone setting?

The calling code is here:

client = new SmtpClient();

\Projects\S9MailMan\Mailer\AsposeMail.cs:line 83
at Logic.DocumentAccess.IndexDocument(Int32 DocID, Int32 ArchiveID, Fields oFields) in C:\Data\Sandbox\ssEdocDev\Logic\DocumentAccess.vb:line 147
The action that failed was:
InheritanceDemand
The type of the first permission that failed was:
System.Security.Permissions.SecurityPermission
The first permission that failed was:
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Flags="UnmanagedCode"/>

The demand was for:
<PermissionSet class="System.Security.PermissionSet"
version="1">
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Flags="UnmanagedCode"/>

The granted set of the failing assembly was:
<PermissionSet class="System.Security.PermissionSet"
version="1">
<IPermission class="System.Security.Permissions.FileDialogPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Access="Open"/>
<IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Allowed="ApplicationIsolationByUser"
UserQuota="512000"/>
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Flags="Execution"/>
<IPermission class="System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Window="SafeTopLevelWindows"
Clipboard="OwnClipboard"/>
<IPermission class="System.Security.Permissions.StrongNameIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
PublicKeyBlob="00240000048000009400000006020000002400005253413100040000010001005542E99CECD28842DAD186257B2C7B6AE9B5947E51E0B17B4AC6D8CECD3E01C4D20658C5E4EA1B9A6C8F854B2D796C4FDE740DAC65E834167758CFF283EED1BE5C9A812022B015A902E0B97D4E95569EB8C0971834744E633D9CB4C4A6D8EDA03C12F486E13A1A0CB1AA101AD94943236384CBBF5C679944B994DE9546E493BF"
Name="Aspose.Network"
AssemblyVersion="4.3.0.3"/>
<IPermission class="System.Security.Permissions.UrlIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Url="file:///C:/Data/Sandbox/ssEdocDev/getSmart/bin/Aspose.Network.DLL"/>
<IPermission class="System.Security.Permissions.ZoneIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Zone="Internet"/>
<IPermission class="System.Drawing.Printing.PrintingPermission, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
version="1"
Level="SafePrinting"/>

The assembly or AppDomain that failed was:
Aspose.Network, Version=4.3.0.3, Culture=neutral, PublicKeyToken=716fcc553a201e56
The Zone of the assembly that failed was:
Internet
The Url of the assembly that failed was:
file:///C:/Data/Sandbox/ssEdocDev/getSmart/bin/Aspose.Network.DLL"

It seems that adding Aspose.Network.Dll to the Assembly Cache setting under .Net Framework Configuration > My Computer corrects the problem. I am not yet sure what security implications this has, or if anything else is going to pop up as a result.