Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ASP.net Error "That assembly does not allow partially trusted callers"

Posted on 2012-04-04
5
Medium Priority
?
611 Views
Last Modified: 2012-06-27
The error i get is "System.Security.SecurityException: That assembly does not allow partially trusted callers"

The Code Is as follows

 Dim doc As Document = New Document
        Dim PDFMemoryStream As MemoryStream = New MemoryStream()
        'PdfWriter.GetInstance(doc, New FileStream(Request.PhysicalApplicationPath + "\1.pdf", FileMode.Create))
        Dim MyPdfWriter = PdfWriter.GetInstance(doc, PDFMemoryStream)
        MyPdfWriter.CloseStream = False

        doc.Open()
        doc.Add(New Paragraph("This Is A Test"))
        doc.Close()

        PDFMemoryStream.Position = 0

        Dim bytes As Byte() = PDFMemoryStream.ToArray

        'Use the following to create on the fly without saving
        Response.Clear()
        Response.ContentType = "application/pdf"
        Response.AddHeader("Content-Disposition", "attachment;filename=\Invoice.pdf")
        Response.BinaryWrite(bytes)
        Response.Flush()
        Response.End()
0
Comment
Question by:taz8020
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 668 total points
ID: 37805623
It looks like you are using an assembly which is not signed (the one housing PDFMemoryStream). You may have to change the security policy for .NET on your web server, but you might try this first:  http://msdn.microsoft.com/en-us/library/8skskf63.aspx
0
 
LVL 5

Assisted Solution

by:Vishal Kedar
Vishal Kedar earned 668 total points
ID: 37805881
0
 
LVL 3

Author Comment

by:taz8020
ID: 37806097
I have checked the trust level in IIS7 and its set to full(internal) any ideas?
0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 664 total points
ID: 37807666
0
 
LVL 3

Author Closing Comment

by:taz8020
ID: 37815327
Hi Thanks all, it was the trust isssue. Iw was set to full intenal but when set to just full then it worked.
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question