System.Security.SecurityException: That assembly does not allow partially trusted callers
<p>i am creating pdf by using itextsharp.dll, local it is working fine. but server am facing below error .i have added assemblyinfo.cs ..but same error is coming.Specifically, I modified the AssemblyInfo.cs file by adding these references and attribute:</p>

<p>using System.Security;
using System.Security.Permissions;
[assembly: AllowPartiallyTrustedCallers] </p>

<p>in my form the pdf throws an error at myDocument.. It never go to read it n throws the below error...</p>

<pre><code>  Document myDocument = new Document(PageSize.A4, 70, 70, 70, 70);
</code></pre>

<p>still am getting the error in server .. can anyone help me out</p>

<p>Server Error in '/' 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.</p>

<p>Exception Details: System.Security.SecurityException: That assembly does not allow partially trusted callers.</p>

<p>Source Error:</p>

<p>Line 216:           HttpContext.Current.Response.End();
Line 217:<br />
Line 218:    }
Line 219:    protected void droplist_SelectedIndexChanged(object sender, EventArgs e)
Line 220:    {</p>

<p>Source File: d:\hosting\bookgroupadmin\agent\checkbeforprintconf.aspx.cs    Line: 218</p>

<p>Stack Trace:</p>

<p>[SecurityException: That assembly does not allow partially trusted callers.]
   finalgroup_checkbeforprintconf.btn_Click(Object sender, EventArgs e) in d:\hosting\bookgroupadmin\agent\checkbeforprintconf.aspx.cs:218
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +7350
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +213
   System.Web.UI.Page.ProcessRequest() +86
   System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
   System.Web.UI.Page.ProcessRequest(HttpContext context) +49
   ASP.checkbeforprintconf_aspx.ProcessRequest(HttpContext context) in App_Web_ovcuievo.18.cs:0
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +358
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +64</p>

<p>Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433 </p>
