The relative virtual path is not allowed here C#

Viewed 17

I'm having issues with this piece of C# code

var localPath = $"Images\\AgencyWatermarkPaid\\watermarkpaid{invoice.AgencyId}.png";
                string targetOutputFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory +
                    localPath);
                var watermarkPath = targetOutputFile;
                iTextSharp.text.Image watermark = iTextSharp.text.Image.GetInstance(watermarkPath);
                watermark.SetAbsolutePosition(-100, 0);
                document.Add(watermark);
    

, I always get the following exception

The relative virtual path 'C:/WorkSpace/BDA/src/BDA.Services/Images/AgencyWatermarkPaid/watermarkpaid20.png' is not allowed here.

0 Answers
Related