Security Exception on Shared Hosting Environment

May 12, 2008 at 11:44 AM

 I was able to set the library up and use it instantly on one of my sites. However, when i do the same on another site hosted on, which i believe uses medium trust level for all dotnet apps, i run into the following exception:

Server Error in '/downloads' Application.
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: That assembly does not allow partially trusted callers.
[SecurityException: That assembly does not allow partially trusted callers.]

I spoke to the folks at 1and1, and they refuse to let my app run under another security policy. I tried searching for ways to let my app run under higher trust, but can't get it to work. I am a DotNet newbie, so maybe i am missing something here. What can i do to make this work either at the application end or the assembly end?

Thanks in advance for the help :)

May 12, 2008 at 11:46 AM
Edited May 12, 2008 at 11:47 AM
Here's a sample of the code i am using:

<%@ Page language="vb" runat="server" explicit="true" strict="true" %>
<script language="vb" runat="server">
    Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs)
        Response.ContentType = "text/plain"
        Dim outputFile As String = Request.QueryString("outputfile")
         Dim outputFileName As String = Server.MapPath(outputFile)
        Dim zipUtil As New Ionic.Utils.Zip.ZipFile(outputFileName)
        zipUtil.TempFileFolder = Server.MapPath("App_Data")
        zipUtil.AddFile(Server.MapPath("test1.txt"), "")
        zipUtil.AddFile(Server.MapPath("test2.txt"), "")
        zipStatus = "successfully zipped the file."
        Response.Write(zipStatus & " : " & outputFileName)
        'End Try
     End Sub  

May 15, 2008 at 3:57 PM
This is now a work item.