C# illegal characters in the path

c#

Solution

I suggest using the appropriate way to join paths in .net: Path.Combine

So

Path.Combine(Application.StartupPath, "CodesLocation","Template.pdf");

Problem

I am getting illegal characters in the path by using the below codes: ``` string fileNameExisting = Application.StartupPath + "\\CodesLocation\\Template.pdf"; PdfReader templateFile = new PdfReader(fileNameExisting); ``` I tested a few variations: ``` string fileNameExisting = @Application.StartupPath + "\CodesLocation\Template.pdf"; PdfReader templateFile = new PdfReader(fileNameExisting); ``` But it is still getting the same illegal error. Can anyone help me see if my code if wrong? Thanks.

Original source