I’m making some tests with Aspose.Tasks and I’m receiving a message error, basically my code work on my XP machine but when I upload to the hosting server (its other company) the Aspose.Tasks stop to work and give me a Open file error message this into inner exception.
Request for the permission of type ‘System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’ failed
The funny thing is this error only happens when I upload a .MPP file when I upload a .MPX everything works fine.
Any idea about how to fix that?
This is my test code:
try{
string fileName = Request.Files[0].FileName;
string extension = Path.GetExtension(fileName);
byte[] stInput = new byte[(int)Request.Files[0].InputStream.Length];
Request.Files[0].InputStream.Read(stInput, 0, (int)Request.Files[0].InputStream.Length);
MemoryStream st = new MemoryStream(stInput);
MPXFile mpx;
if (extension.ToLower() == ".mpx")
mpx = new MPXFile(st);
else
mpx = new MPPFile(st);
String sTasks = "";
//foreach (Task t in mpx.ChildTasks[0].ChildTasks)
// sTasks += TaskToJSON(t);
Response.Write(sTasks);
}
catch (Exception ex)
{
Response.Write("ERROR: " + ex.Message);
if (ex.InnerException != null)
Response.Write("
ERROR: " + ex.InnerException.Message);
}
I couldn't solve it yet; I don’t have much access to live because it’s hosted on digiweb; I already sent some e-mails to then and I didn’t receive any answer so far. I’m wondering if the aspose.dll is trying to read or write some file, it can be causing the error because probably aspose.dll don’t have this permissions for a anonymous user.
I’m going to make some tests this week using Windows 2003 server and try to reproduce this error. If you have any idea about what is going on, please let me know it can be helpful.
Note: I’m using demo license yet, I don’t know if it can make any difference.
Feel free to drop me an e-mail Regards Fabio Torres
I could reproduce the problem locally, the difference between the computer are the security level, the hosting server are using a medium trust setup and by default the .Net framework is set to full trust.
To reproduce the problem I used one Virtual Machine with Win2003 server and the following article to setup the a medium trust How To: Use Medium Trust in ASP.NET 2.0 | Microsoft Learn ; after this setup I got the same error of the hosting. This is the full error stack.
Currently Aspose.Tasks uses System.Windows.Forms.RichTextBox to process mpp properties with text in rtf format. It doesn’t work with medium trust level. We will investigate possibility to avoid using it in the next release.