0

I need to use an external .dll file with itextsharp in my solution. Under development environment everything is fine. But same code in production server is giving an error. when checked in the log files, it shows:

Application error when access /_layouts/15/TransmittalRibbonControl/Transmittal.aspx, Error=The remote server returned an error: (401) Unauthorized. at System.Net.HttpWebRequest.GetResponse() at iTextSharp.text.pdf.RandomAccessFileOrArray..ctor(String filename, Boolean forceRead) at iTextSharp.text.pdf.TrueTypeFont.Process(Byte[] ttfAfm, Boolean preload) at iTextSharp.text.pdf.TrueTypeFont..ctor(String ttFile, String enc, Boolean emb, Byte[] ttfAfm, Boolean justNames, Boolean forceRead) at iTextSharp.text.pdf.BaseFont.CreateFont(String name, String encoding, Boolean embedded, Boolean cached, Byte[] ttfAfm, Byte[] pfb, Boolean noThrow, Boolean forceRead)

  • is it a web part? – Muhammedh Aug 19 '15 at 14:49
  • has the dll been installed in your prod farm? – Eric Alexander Aug 19 '15 at 14:53
  • yes it is visual web part.. and yes dll is installed in GAC.. – Ankitkumar Malde Aug 19 '15 at 14:57
  • is the DLL added in the Packages > Advanced > Safe Control entry? – Muhammedh Aug 19 '15 at 14:59
  • I have added dll to package but not to safe control. i will try adding the same to safe control, can u help me with Namespace and Assembly name of iTextsharp dll to add them into safe control – Ankitkumar Malde Aug 19 '15 at 17:00
1

Try adding the dll as SafeControl entry. Steps are given below:

  1. Navigate as shown below:

    enter image description here

  2. Under Advanced Tab, select as shown below:

    enter image description here

  3. Fill as shown below in the Add Existing Assembly window.

enter image description here

Note: You can place your dll in the web application's BIN folder in the server and pick like shown above.

  • Can we use same Dll for tow or application already deployed in GAC? – Ankitkumar Malde Nov 10 '15 at 6:09
  • 1
    Yes, make sure you do reference from 80/Bin folder so that both the applications refer to the same dll. – Muhammedh Nov 10 '15 at 7:57
0

Found the Solution at Last, Error=The remote server returned an error: (401) Unauthorized. at System.Net.HttpWebRequest.GetResponse() was from external font being called from _layouts/15/ and was not getting Authenticated from the server.

Reason for not getting authentication, when I was not able to open site from server using DNS name.

So once the above issue was resolved, my code started working fine.

Thanx a lot Muhammedh for the help...!!!

  • your welcome brother :)! – Muhammedh Nov 10 '15 at 8:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.