yad4u ITextSharp saying File not found when published to My server

ITextSharp saying File not found when published to My server

I am using ItextSharp and I am getting a new font for it by doing this

string  fontPath = Path.GetFullPath("C:\\BMSApplicationFiles\\Fonts\\FREE3OF9.TTF"); BaseFont barCodeBase = BaseFont.CreateFont(fontPath, BaseFont.CP1252, BaseFont.EMBEDDED); 

That file is in that directory on both my dev machine and the server. When i run this on my dev machine it works fine, when published to my server I get an error saying FREE3OF9.TTF is not found as a file or a resource. I have double and triple checked that the file is in fact there on my server. My application has full trust on IIS. and IIS user has full access to this folder. And still I get this error. Very frustrating. Any ideas??

This code is Not inside the Web Application but inside a DLL class library that the web application is referencing. Do I need to add any more special permissions or something?

ASP.NET MVC output cache with dynamic fragment


Redirect site from www.a.com to a.com in asp.net mvc
Your next step should be to confirm that what you think is happening is happening.

Jquery thickbox to work with Url.Action link in Asp.net mvc
If you are allowed to, download and install Process Monitor which will allow you to log activity including which files are being attempted to be accessed and by which user account.

Structuring several mostly-static pages in ASP.NET MVC
Apply filters when monitoring of course, or else you'll end up seeing all the activity on the server....
Function to display a DateTime string or an empty string
If that only confirms that the correct file is being attempted to be read by expected user then maybe there's something up with the font.

Visual Studio 2010 RC + ASP.NET MVC 2 RTM won't re-target from .NET Framework 4 to 3.5
Try replacing the font file temporarily with another standard one (e.g.

MVC2 and Session Start Event
arial or something) and see what happens.

Test Function in MVC Project
(this is unlikely to help as it works on your dev machine, but might be worth a go).


Most probably you have a security issue.. If you run IIS7 then check that IIS_IUSRS group has an access to the file (open file properties in explorer select Security tab etc).

. If you run IIS6 then check that IUSR_MachineName account has an access to the file..


I had a similar error when I tried to get it working with IIS.

Within IIS, I had to add he file directory as a virtual drive.

That worked for me when I had a similar situation set up.

Hopefully it works for you, best of luck.

94 out of 100 based on 74 user ratings 1324 reviews